Creating cronjobs with plugin inside Kanboard

Hello!
I am developing plugin for Kanboard
And its needed to make automatic timed actions (by cron) inside and outside Kanboard

How can i add my own task to kanboard cronjob shelude?
I tried to search information in documentation or plugin with same founctionality - and didnt find anything.
Can you say which methods is using to create cronjobs and how to use these methods?

You have to create an automatic action that is listening to the event EVENT_DAILY_CRONJOB.
But your description is far too vague, sorry.

I have a simple action in my controller - send me information about project. This action is working by manual start.
I want to force cron to execute this action 3 times per a day. I dont need to update this action options or change it - i want to add this action only one time (may be in plugin.php) to cron shelude and its all.

You need an additional crontab entry for this.
I have done something similarly in the Mailmagik plugin, we have an additional ‘cron’ command there. You might have a look at this code.

1 Like

Yeah, exactly! This is what i want to get to know)
Sorry for my broken explanation, english not my native language)

Thank you, i will explore how it implemented in Mailmagik plugin.

1 Like

Hello again.
Can you suggest, where is in your code happens adding crontab entry?

I tried realise it in my code - after i fixed couple of mistakes, just nothing happens. Kanboard works same as before and nothing happens.

Maybe a misunderstanding. The crontab entry is a system configuration, it has to be done via shell or appropriate tool.

https://docs.kanboard.org/v1/admin/cronjob/

But by our code we have created a dedicated command that can be called via cron besides the normal cronjob.

# m h  dom mon dow   command
10 0 * * * /usr/bin/php -f /path/to/kanboard/cli cronjob
*/5 * * * * /usr/bin/php -f /path/to/kanboard/cli mailmagik:fetchmail

Ah, ok
Did I understand correctly that inner kaboard cron-tool doesn’t have own sheluder?

Is it real to create plugin that intruding in classic cronjob and does not require the user to intervene in the server settings?

Yes, everything must be triggered by system cron.

1 Like

I don’t think this is useful. The normal cronjob is usually run every 24 hours and triggers the sending of task due mails to the users. If you increase the frequency, you’ll get reminded at every cronjob run.

1 Like