Cron job not running
Cron job not running
I have searched this forum and tried many solutions but I just can't get it to work.
I have a script here /home/admin/web/mydomain/public_html/rclone-cron.sh as below to use rclone to backup to Backblaze
If I run from a terminal (logged in as admin) the backup runs no problem.
Howver I cannot get it to run in cron, command as below,
I have checked the cron log in /var/log and find the lines,
But no backup perfomed, only when I run the command from a terminal does the backup run.
Any ideas?
I have a script here /home/admin/web/mydomain/public_html/rclone-cron.sh as below to use rclone to backup to Backblaze
Code: Select all
#!/bin/bash
if pidof -o %PPID -x "rclone-cron.sh"; then
exit 1
fi
rclone sync /home/admin/web/mydomain/public_html/ remote:bucket
exit
Code: Select all
/home/admin/web/mydomain/public_html/rclone-cron.sh
Howver I cannot get it to run in cron, command as below,
Code: Select all
sudo /home/admin/web/mydomain/public_html/rclone-cron.sh
Code: Select all
Apr 11 06:00:01 vultr CROND[6886]: (admin) CMD (sudo /home/admin/web/mydomain/public_html/rclone-cron.sh
Any ideas?
-
- Posts: 33
- Joined: Sat Jan 20, 2018 3:45 am
- Os: Debian 8x
- Web: apache + nginx
Re: Cron job not running
replace sudo with /bin/sh or /usr/bin/shHenrysCat wrote: ↑Wed Apr 11, 2018 8:43 amI have searched this forum and tried many solutions but I just can't get it to work.
I have a script here /home/admin/web/mydomain/public_html/rclone-cron.sh as below to use rclone to backup to BackblazeIf I runCode: Select all
#!/bin/bash if pidof -o %PPID -x "rclone-cron.sh"; then exit 1 fi rclone sync /home/admin/web/mydomain/public_html/ remote:bucket exit
from a terminal (logged in as admin) the backup runs no problem.Code: Select all
/home/admin/web/mydomain/public_html/rclone-cron.sh
Howver I cannot get it to run in cron, command as below,I have checked the cron log in /var/log and find the lines,Code: Select all
sudo /home/admin/web/mydomain/public_html/rclone-cron.sh
But no backup perfomed, only when I run the command from a terminal does the backup run.Code: Select all
Apr 11 06:00:01 vultr CROND[6886]: (admin) CMD (sudo /home/admin/web/mydomain/public_html/rclone-cron.sh
Any ideas?
if still not working try to chmod the file
Code: Select all
chmod +x /home/admin/web/mydomain/public_html/rclone-cron.sh
Re: Cron job not running
Tried both no joy, rclone-cron.sh permissions are 755, as I said it runs manually from terminal logged in as admin, just not in cron.replace sudo with /bin/sh or /usr/bin/sh
if still not working try to chmod the fileCode: Select all
chmod +x /home/admin/web/mydomain/public_html/rclone-cron.sh