Problems with Cron Job

What is the problem you are having with rclone?

rclone itself is running, but I can't get it to run in a cron job as root user.

What is your rclone version (output from rclone version)

rclone v1.57.0

  • os/version: ubuntu 20.04 (64 bit)
  • os/kernel: 5.4.0-91-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.17.2
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

pcloud

The command you were trying to run (eg rclone copy /tmp remote:tmp)

I have a VM running under Proxmox on Ubuntu Server 20.04.3. A USB hard disk (NTFS) is mounted there. Thus the owner is always root:root. When I execute the command below on the shell, everything runs as I want, i.e. files and folders are "backed up" from the pcloud to the local USB hard drive.

/usr/bin/rclone sync 'pcloud:' '/mnt/usb/BackupPCloud/' --progress --create-empty-src-dirs --config="/root/.config/rclone/rclone.conf"

The rclone config contents with secrets removed.

Here are the contents of /root/.config/rclone/rclone.conf

[pcloud]
type = pcloud
token = {"access_token":"here is my token","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}
hostname = eapi.pcloud.com

Here my cron job:

1.) sudo su -
2.) password
3.) crontab -e

*/5 * * * * /usr/bin/rclone sync 'pcloud:' '/mnt/usb/BackupPCloud/' --progress --create-empty-src-dirs --config="/root/.config/rclone/rclone.conf"

It should run every 5 minutes until the cronjob finally runs. If I could then see the process "rclone" in a second shell via "top" or read out the logfile via tail, I would know that the cron job is running.

But it simply does not do that

I have also tried to call the command as a cron job with "root", also without success.

*/5 * * * * root /usr/bin/rclone sync 'pcloud:' '/mnt/usb/BackupPCloud/' --progress --create-empty-src-dirs --config="/root/.config/rclone/rclone.conf"

I would actually like to achieve the following. At night at 01:00 rclone should start the backup job to the USB hard disk. Since I am only connected to the internet with LTE, the job takes up all my bandwidth. In the morning at 06:00, a "killall rclone" should also end rclone via cron job. In this way, I make a little progress every day.

Thanks for your help

Greetings H-BLOGX

Schedule it to a time you can test.
Add in --log-file /somepath/rclone.log to your command

Check the log file for the error.

After a bit of trial and error, it now seems to work. For me, it's kind of funny (or not at all, actually). Since I'm only connected with LTE, the rclone process takes my full download bandwidth. If I then run a stream via Amazon Alexa or Netflixe, for example, everything breaks off completely, even though I have configured these devices for QoS in my router. But that's not a big deal at the moment, because I start the cron job at 01:00 in the morning (when I'm normally asleep) and then kill it at 06:00. According to the log file, the time stamp also fits here.

Here is what I have done:

1.) Login to the Ubuntu Server 20.04 VM with sudo su -
2.) Then crontab -e
3.) Inserted these two lines at the end

0 1 * * /usr/bin/rclone sync 'pcloud:' '/mnt/usb/BackupPCloud/' --progress --create-empty-src-dirs --config="/root/.config/rclone/rclone.conf" --log-level INFO --log-f>
0 6 * * * /usr/bin/killall rclone > /dev/null 2>&1

4.) Exit and restart cron service with sudo service cron restart

Enjoy :grin:

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