I am trying to setup a cron job for rclone to sync files to Google Drive. I can run the script manually and it works (doesn’t ask for password or anything either). Here is my code:
Script:
#!/bin/bash
if pidof -o %PPID -x “rclone-plex-upload.sh”; then
exit 1
fi
rclone sync /mnt/md0/plex/movies GoogleDriveCrypt:/ -v --min-age 15m --log-file=/var/log/rclone/rclone-plex-upload.log
exit
Cron Tab:
*/5 * * * * /usr/local/bin/rclone-plex-upload.sh
Can anyone explain why when I run the script manually it works, but the cron job doesn’t work?
Thanks in advance.
Edit: Fixed it. Moved the script to it to my user in /home and ran it from there.
haha i just came on to post the exact same thing.
I took some tips from you, but still cant get it working.
I’m on a seedbox so not sure if thats the reason why…
I put my upload script in /home2/rich/bin/upload.sh
the script is:
#!/bin/bash
if pidof -o %PPID -x “rclone-plex-upload.sh”; then
exit 1
fi
rclone move /home2/rich/download/ acdencrypt: -v --min-age 10m --log-file=/home2/rich/logs/acd-cron.log
exit
my cron is:
*/2 * * * * /home2/rich/bin/upload.sh
Like the OP i can run it manually but the cron doesnt start it
Any ideas?
I had a similar issue with one script mine.
First, check by
service cron status
if the CRON had called your script and if the service is started. In my case I have to set some variable of the environment.
Check it on SO http://stackoverflow.com/questions/20523925/using-notify-send-with-cron if the bash had been called.
1 Like
Funjuju
(Julien DELILLE)
April 16, 2017, 9:04am
4
Hi,
For Cronjob you need to use Absolute path to avoid environment problem
So instead of rclone move ==> /usr/sbin/rclone move
2 Likes
My cronjob fixed because of this hint