Custome Cron Job Not Working in latest version ERPNExt

Hey All,

Now I have schedule custom cron job but it’s not triggerd and not showing any error and i also on scheduler bench enable-scheduler but not working …

Hello @rmehta
any solution

Hey Hii @kolate_sambhaji any solution

have you found any solution?

put it on the hooks.py file

its already on hooks.py file of custom app.

can you share code ?

scheduler_events = {
	"daily": [
		"custom_app.main.send_outstanding_notifications_long",
		"custom_app.main.block_customers_long",
		"custom_app.main.vehicle_notif_long",
	],
	"hourly": [
		"custom_app.www.items.make_cache_items_long"
	],
	"cron":{
		"0 18 * * *":[
			"custom_app.main.day_before_delivery_notifications"
		],
	}
}

None of them is working.

can’t you just put it inside the frappe folder ?

no i dont want to disturb frappe or erpnext app, i want to use custom app.

This may be a dumb suggestion, but, did you run bench --site sitename enable-scheduler?
Other possible reason is that maybe scheduler_events is declared multiple times in your hooks.py

just do bench migrate and check.

1 Like

currently declaring on hooks is not working, you have to add an entry for cron in Scheduled Job Type Doctype

@hereabdulla I think that is not required to do manually.
bench migrate will add that.

:+1: @Maheshwari_Bhavesh

bench migrate works. but it is not running cron jobs.

"all": [
        "backup.task.task0"
    ],
    "cron": {
        "* * * * *": [
            "backup.task.task1"
        ],
        "*/3 * * * *": [
            "backup.task.task2"
        ],
    }

In above example “all” is working but “cron” tasks are not working