Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.29 KB

README.md

File metadata and controls

40 lines (26 loc) · 1.29 KB

Sync your Kimai data via API to a local database

Installation

  • Clone the repo: git clone [email protected]:kimai/api-sync.git kimai-api-sync
  • Create the database and then the necessary tables, structure can be found in database.sql
  • Execute php composer.phar install --optimize-autoloader -n
  • Edit configuration.php and adjust settings to your needs

Usage

The sync script can be run with php sync.php and it has two optional parameters:

  • --modified="2024-01-01 12:00:00" - only sync timesheets, which were changed after a certain date-time, format: YYYY-MM-DD HH:mm:SS
  • --timesheets - only sync timesheets

If --modified is skipped, only the latest 24 hours will be synced

Initial sync

For the initial sync you should choose a date far in the past, so all non-synced timesheets will be fetched:

php sync.php --modified="2020-12-31 00:00:00"

Cronjob

Now you can easily fetch latest changes via cronjob.

If you installed the project into /opt/kimai-api-sync/ and want to sync once a night you might want to use something like:

17 3 * * * /usr/bin/php /opt/kimai-api-sync/sync.php --modified="2020-12-31 00:00:00" --timesheets >> /var/log/kimai-api-sync.log 2>&1