I have been trying to run a cron job which runs every 15 minutes but it keeps running every minute
hooks.py
scheduler_events = {
"cron": {
"*/15 * * * *": [
"footwear_erpnext.tasks.cron.testing_cron_job"
]
}
}
I have been trying to run a cron job which runs every 15 minutes but it keeps running every minute
hooks.py
scheduler_events = {
"cron": {
"*/15 * * * *": [
"footwear_erpnext.tasks.cron.testing_cron_job"
]
}
}
Try to execute it in the terminal first to check if the path and function is ok using:
bench execute footwear_erpnext.tasks.cron.testing_cron_job
if everything is ok then use these commands to enable the scheduler:
bench enable-scheduler
bench scheduler enable
bench scheduler resume
bench trigger-scheduler-event all
sudo supervisorctl restart all
Also worth a try:
bench --site erp.next.host migrate;
bench --site erp.next.host clear-cache
They tend to clean up things that have got themselves tied up in knots.
Btw.
Making many changes?
Running a bash
based Linux distribution?
You might enjoy to put this in your file ~/.bash_aliases
alias flush="bench --site erp.next.host migrate; bench --site erp.next.host clear-cache"
Then, whenever you suspect divergence between filesystem and database definitions, just type flush
.
Please don’t suggest migration for cron issue, I’ve also followed a same answer like you for the scheduler issue but it ended up removing all my customization (I was new to frappe back then)
Agreed
Don’t forget about dormant_days.
If your last activity log >= dormant days, then cronjob only run once a day