Rclone script won't run in crontab

Hi, I’m trying to set up a timelapse on my raspberry pi which syncs with google drive via rclone.
the camera.sh (taking photo) script works automatically (every 30 minutes) using crontab, but the clone.sh script,which should upload the photo to Gdrive, only works if I run it manually (not when crontab is running)
the crontab is a follows now…

*/30 * * * * sh /home/pi/Pictures/timelapse/camera.sh
*/30 * * * * sh /home/pi/Pictures/timelapse/clone.sh

what am I missing?
the clone.sh script is:
#!/bin/sh
/usr/local/bin/rclone -v sync /home/pi/Pictures/timelapse remote:RPi --max-age 10m --include *.jpg

If you save the log to a file --log-file /tmp/rclone.log then you’ll get an error message you can look at.

I’d guess it is because HOME isn’t set in the crontab in which case supplying --config will fix it.

Or you can use an environment variable to point to your config file as I use a custom location and set it in my scripts:

# RClone Config file
RCLONE_CONFIG=/opt/rclone/rclone.conf
export RCLONE_CONFIG

I think for some reason there is no config file on the raspberry pi, the error it gives is that the command doesn’t find the rclone.config file (I just ran $ find / rclone.config through the whole RPi, nothing.)
Which doesn’t quite explain why the script works when commanded manually…

If you are logged in, you can use:

rclone config file
Configuration file is stored at:
/opt/rclone/rclone.conf

alright! it finally works! Thanks a lot guys!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.