I noticed today that on one of my servers, the one that isn’t isn’t on the internet, there is only one backup file in /home/frappe/frappe-bench/sites/sites1.local/private/backups/ (with date likely from initial install). I ran the backup command from the frappe user cron script manually (/var/spool/cron/frappe), and got a fresh backup. Also crond is running. Any ideas why I’m not getting backups by default? What should I check?
Executing the commands manually creates a backup as expected.
[root@hotstuff ~]# cd /home/frappe/frappe-bench/sites
[root@hotstuff sites]# /home/frappe/frappe-bench/env/bin/frappe --backup all >> /home/frappe/frappe-bench/logs/backup.log 2>&1
[root@hotstuff sites]# ll /home/frappe/frappe-bench/sites/site1.local/private/backups/
total 772
-rw-r--r--. 1 root root 232526 Dec 2 10:51 20141202_59392841_database.sql.gz
-rw-r--r--. 1 root root 270514 Dec 5 16:00 20141205_43867489_database.sql.gz
-rw-r--r-- 1 root root 280652 Dec 8 14:41 20141208_60772977_database.sql.gz
[root@hotstuff sites]#
(the three files were all created by manually executing commands from frappe user cron file).
I then added a path statement to the frappe user cron file (/var/spool/cron/frappe), and hopefully I’ll see backup files from tonight when I get into work in the morning.
[root@hotstuff ~]# cat /var/spool/cron/frappe
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# run frappe backup
0 */6 * * * cd /home/frappe/frappe-bench/sites && /home/frappe/frappe-bench/env/bin/frappe --backup all >> /home/frappe/frappe-bench/logs/backup.log 2>&1
[root@hotstuff ~]#
I see a problem here. There are some files owned as root. Maybe that's the issue as the backup script tries to remove old files and would be crashing trying to remove the files it doesn't own.
My $PATH suggestion doesn't make much sense as even if mysqldump doesn't exist in the path, it would still create empty backups.