Howdy, I know there are years of posts related to this and I've read many of 'em. I still haven't got this working, so, I come hat in hand to ask for help.
What is the problem you are having with rclone?
rclone is the answer I've been looking for. I can use rclone from command line. It works when I put it in a bash script (*.sh) and I can call it through python scripts too, (*.py). But I can't get it to work from cron. Not if I put the command in the crontab, not if I call the script (*.sh or *.py) from cron. I can cron plenty other jobs, but somehow it's like cron is ignoring rclone. Maybe that's a clue.
What is your rclone version (output from
pi@zero-tester:~ $ rclone version rclone v1.53.2 - os/arch: linux/arm - go version: go1.15.3
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Raspberry Pi OS (32-bit) Lite
Minimal image based on Debian Buster
Version: August 2020
Release date: 2020-08-20
Kernel version: 5.4
Which cloud storage system are you using? (eg Google Drive)
The command you were trying to run (eg
rclone copy /tmp remote:tmp)
pi@zero-tester:~ $ rclone move /home/pi/Google/ Google:/rpi/ pi@zero-tester:~ $ /usr/bin/rclone move /home/pi/Google/ Google:/rpi/ pi@zero-tester:~ $ /home/pi/google.sh
The google.sh script looks like this:
#!/bin/bash if pidof -o %PPID -x "google.sh"; then exit 1 fi # move files from local/source to cloud:destination /usr/bin/rclone move /home/pi/Google/ Google:/rpi/ exit
pi@zero-tester:~ $ sudo chmod +x google.sh
However, when I open crontab
pi@zero-tester:~ $ sudo crontab -e
and insert any of these jobs I get no action.
*/1 * * * * /usr/bin/rclone move /home/pi/Google/ Google:/rpi/ */1 * * * * /bin/bash /home/pi/google.sh >/dev/null 2>&1 */1 * * * * /home/pi/google.sh
NOTE: I tried those ^ by editing
~ $ sudo crontab -e
Should I be entering rclone as a job in this file below?
~ $ sudo nano /etc/crontab
Also, I have read many comments on cron SHELL and PATH. Here is what my /etc/crontab file shows ...
So that's where I'm coming from. I'm using a Raspberry Pi. My use case is this: when a sensor triggers I make a note in a log. We copy that log to a backup directory called
and then in the script (python) I can run
import subprocess subprocess.call(['sh','/home/pi/google.sh'])
and it works.
But I want to schedule cron jobs to upload the logs at intervals rather than every time a sensor triggers. I can imagine workarounds, but I want this to work in cron. I use cron for other jobs. Love it. What am I missing? I bet it's something fundamental and easy but I don't really understand cron or bash, SHELL or PATH. So I just haven't figured it out yet. Really appreciate any help.