Scheduler stops by itself

I might be even wrong but scheduler stops working until I restart the server. How can I make it reliable?
Download Error logs

This is the workerbear.error log

Stale pidfile exists. Removing it.
[2015-10-13 17:35:10,509: INFO/MainProcess] beat: Starting…
[2015-10-13 17:39:09,457: INFO/MainProcess] Scheduler: Sending due task scheduler (frappe.tasks.enqueue_scheduler_events)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
ERROR: Pidfile (celerybeat.pid) already exists.
Seems we’re already running? (pid: 1588)
Stale pidfile exists. Removing it.
[2015-10-14 09:58:02,811: INFO/MainProcess] beat: Starting…
[2015-10-14 09:58:02,855: INFO/MainProcess] Scheduler: Sending due task scheduler (frappe.tasks.enqueue_scheduler_events)

Are you using bench start or do you have production setup?

Production setup - used .sh file to install. Everything is vanilla never touched anything.

Redis server stops following the advice given the link under

@ferohers

Can you give me the output of this command: sudo supervisorctl status

also, ps aux | grep celer_app

Also check if there is a celerybeat.pid file in the frappe-bench/sites folder

Between the posts (( I removed dump.rdb under /var/lib/ )). That’s the only change I did

supervisorctl status

frappe:frappe-web RUNNING pid 1647, uptime 1:47:41
frappe:frappe-worker RUNNING pid 1643, uptime 1:47:41
frappe:frappe-workerbeat RUNNING pid 1648, uptime 1:47:41
node-socketio RUNNING pid 1650, uptime 1:47:41
redis-async-broker RUNNING pid 1649, uptime 1:47:41
redis-cache RUNNING pid 1678, uptime 1:47:41

altan@ERP:~$ ps aux | grep celer_app
altan 2105 0.0 0.1 11748 2152 pts/1 S+ 13:35 0:00 grep --color=auto celer_app

/sites folder has a .pid file

altan@ERP:~/frappe-bench/sites$ ls
apps.txt celerybeat.pid languages.txt test.schedule
assets currentsite.txt site1.local

Don’t remove the rdb without stopping redis,
Try to recover like this,

sudo supervisorctl stop frappe:frappe-worker
sudo supervisorctl stop frappe:frappe-workerbeat
sudo service redis-server restart
redis-cli flushall # wipe all data
rm /path/to/sites/celerybeat.pid
rm /path/to/sites/test.schedule
sudo supervisorctl start frappe:frappe-worker
sudo supervisorctl start frappe:frappe-workerbeat
1 Like

The problem is solved by following pdvyas’s suggestion.