Closed mxgross closed 1 year ago
Idea:
Currently I don't see any other way to do this with symfony only.
Thank you for creating this plugin. The ability to start the backup with a cronjob would be really nice. Did you maybe come up with a solution?
Hi, no I have not worked on this feature yet.
Hi, I just started using your plugin and I like it a lot. The cron job feature would be really nice to have :) In addition I would like to ask, is there any option to create backup through the CLI (bin/console command)? If this is possible, I can create my own cron trigger with OS tools.
Hi, thanks for your feedback. I started building a command so the backup creation could be done via terminal/command line.
e.g. php bin/console EasyBackup:backup
.
But I still need to figure some things out.
That's nice :) I'm looking forward for this feature.
Hi @Tobisaninfo , @darioseidl I implemented it at the 'BackupCommand' branch. Would it be possible that you also test it? Pull-Request: https://github.com/mxgross/EasyBackupBundle/pull/51 I also append the ReadMe, but to make things short, this is how you can set it up as cronjob:
crontab -e
to open the file for editing.
' * php /var/www/html/kimai2/bin/console EasyBackup:backup > /home/YOUR-USERNAME/EasyBackupCron.log'
This will execute a backup every minute (for testing purpose) and you can check the log if anything fails.
But you can also call the command directly via terminal.
Maybe @kevinpapst will also have a look at it and suggestions for improvement. But my plugin is not yet Kimai2 Version 2 ready.
Thanks
Hi @mxgross,
I checked out your branch on my kimai installation und on reloading the cache I got this error:
[ERROR] Expected to find class
"KimaiPlugin\EasyBackupBundle\Tests\Command\EasyBackupBackupCommandTest
" in file
"/opt/kimai/var/plugins/EasyBackupBundle/Tests/Command/EasyBackupBackup
CommandTest.php" while importing services from resource "../../*", but
it was not found! Check the namespace prefix used with the resource.
To reload the cache, I use this command: docker exec kimai2-kimai-1 php /opt/kimai/bin/console kimai:reload --env=prod
. (Yes my docker container name is a little bit strange with all of these numbers 😄)
Thanks a lot for your effort to implement such a command.
Thanks for your feedback @Tobisaninfo Kevin already had very good suggestions for my pull-request. I will work on them and also fix the namespace error you mentioned.
Hi @Tobisaninfo, I merged my code into the master. Please let me know if it works as expected.
Hi @mxgross,
thank you very much for your fast help. I checked your new version out and could create a backup right from the CLI as expected. So it works great for me. My cron trigger looks like 0 2 * * * docker exec kimai2-kimai-1 php /opt/kimai/bin/console EasyBackup:backup 1>/var/opt/kimai/log/backup.log
. So now every night, a backup will be created.
Thanks again :)
Cool, thanks for your fast reply :)
The user should be able to define a cron job, so that e.g. every night a backup is created.