Open simonschaufi opened 6 years ago
Not sure what the benefit of that artisan scheduling is. Is it a way around crontab? You still need to register the artisan command, so you could do it better documented in cron.d file anyway? You could even keep it under source control and just symlink your cron directives.
What cronjobs do you want to schedule, commands offered by kimai through the symfony console?
I am currently investigating some possible solutions. This is my favorite library so far (just from reading, not tested yet): https://github.com/Cron/Cron The idea is not that bad, the admin has to create only one cron job for Kimai and can then forget about it. Every plugin developer could simply register their own cron job, without the need to edit crontab again.
On the other hand it is a lot of code overhead for a task, which is perfectly stable from OS side.
Yeah, that seems like a alot of overhead in comparison to a cron.d file.
This app could just deliver a template like
# /etc/cron.d/kimai
www-data * * * * * cd app && bin/console kimai:do1
www-data */5 * * * cd app && bin/console kimai:do2
www-data @daily cd app && bin/console kimai:daily
that could be symlinked, copied, easily modified, changed and so on. As long as you need to add a crontab/cron.d job anyway, there is no benefit in having your app trying to be the os responsible for these tasks.
On the other hand you could provide a simple controller action that could be triggerable on the public url, for the really worse cases where php-cli has highly different settings/version/user than php-fpm (leading to unwritable cache dirs and so on) or you do not have shell access or your hoster only allows you to pull an url. And for that you could inject the commands directly into the controller and call them without any additional dependency.
This is exactly what I was looking for!
Sounds like this one can be closed?
No, it's not yet implemented
@simonschaufi the bundle mentioned by @kevinpapst was no help?
I'm not talking about a support request but about a core feature of kimai which makes it much easier for plugin developers to add cronjobs without adjusting any crontab config.
Description
In order to send automated emails, I need an entry point for my cronjob (like a global scheduler) where I can register my cronjob task to be executed.
Laravel has it here: https://laravel.com/docs/8.x/scheduling. Maybe there is also something available for symfony?
The alternative would be to make CommandControllers for every single cronjob (which works already).