rClone Scheduling

anyone have any ideas?

the script seems to be working. Its just crontab isn’t.

is it because rclone is asking for config password that its not working correctly?

@lowfront
put this in your script ( above the rclone command )
export RCLONE_CONFIG_PASS=yourpassword.
I just noticed that @ncw added this option a while back
https://github.com/ncw/rclone/commit/7392cd1a1a0ee462a9e9f2924ee6216d69b5bd65

1 Like

I got the script working without asking for a password by creating a file called set-rclone-password

#!/bin/echo Source this file don’t run it

read -s RCLONE_CONFIG_PASS
export RCLONE_CONFIG_PASS

Then I ran
source set-rclone-password

I was prompted for password. Now I can manually run the script without any password prompts. I also had to add --ask-password=false to the script.

But the scheduling still isn’t working in crontab

post your crontab command

*/15 * * * * /home/lowfront/rclone-cron.sh >/dev/null 2>&1

I have also tried

0,30 * * * * /home/lowfront/rclone-cron.sh >/dev/null 2>&1

I appreciate your time brother

Can you try setting the password just with this:
export RCLONE_CONFIG_PASS=yourpassword

then test the script and then check the if its running in cron.

ok that password addition to the script is working when I manually launch it.

but still issues with cron.

*/2 * * * * /home/lowfront/rclone-cron.sh >/dev/null 2>&1

this should work if I want to check every 2mins right?

If you really want to do better you need an agent to store the password for you.

You can encrypt your password with gpg and use the gpg agent to decrypt it for you for instance.

1 Like

Hi Ajki,

just added your script to cron - everything works - but i get a new rclone task every 30 minutes …8)

Looks like the script is not detecting the running bash script … 8(

Is there any way to getter “detection” (not targeting “rclone” because this task is running twice because of mounting with rclone) ?

Greetings

FoGBaV

Add this on top ( bellow /bin/bash )

if pidof -o %PPID -x “$0”; then
echo “$(date “+%d.%m.%Y %T”) Exit, already running.”
exit 1
fi
Basically if script with same name is already running it will exit.

1 Like

Will test - thank you very much !

Greetings

FoGBaV

What is the exit at the end for?

The exit in the end isn’t needed. It doesnt do anything besides exit the script. Without it, it would do the same thing.

I’m pretty sure my initial rclone sync is going to take weeks to complete, what happens if I schedule (crontab) every day 30 minutes? Will the multiple instances of rclone keep piling up?

Would it be better to start an initial sync and notify me when that’s done, and then kick off a cron occur ace every 30 minutes.

I have 60 files being uploaded from sensors every 15 minutes and something like 200 sensors. Each file is about 12k. The good news is my wan link is gigabit or better.

Brian Chee

Yes they will. You need to put a bit of locking in the script.

That might be a better plan

thanks for your all help. this works for me.

but in crontab -e i use this command

*/5 * * * * sh /media/rclone_update.sh >/dev/null 2<&1

*/5 for run the script every 5 Minutes and the sh command to execute the script. works for me :slight_smile: