No backups by default on new centos 7 install

Continuing the discussion from Does mysqldump work for simple backup?:

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?

Thanks,
Dale

So, you confirm that the job is there, crontab -l -u frappe? Is this on Cent OS7? Can you confirm if mysqldump is in the PATh when the cronjob is run?

Hi pdvyas, I’m using Centos 7, and the job did get created by the “easy way” install.

[root@hotstuff ~]# crontab -l -u frappe
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 ~]#

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.

Thanks for hint. I changed the owner of the log files to frappe, and am waiting for next automatic backup to confirm if all is OK.

Having log files owned by root was caused by running the backup script manually after I had loaded all my users into the data base.