I'm trying to setup a periodic job for rclone to run my sync command every 5 minutes or so. I found a similar thread here but I'm making my own thread to clear up a few concerns.
Is the batch script written in the link above correct? If so, how can I change it to 5min instead of 5 seconds?
How can I add a line to the script that prevents the script to run if it is already running?
What is your rclone version (output from rclone version)
rclone version
rclone v1.53.3
- os/arch: windows/amd64
- go version: go1.15.5
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Windows 10
Which cloud storage system are you using? (eg Google Drive)
Google Drive
The command you were trying to run (eg rclone copy /tmp remote:tmp)
i wrote that script.
it uses timeout command.
run this for help timeout /? and you will get the help text
for 5 minutes, change the /T parameter to a value of 300
using task scheduler, there is a dropbox, 'do not start new instance`
The easiest way I have found is to point the scheduler to open rclone.exe and paste my command into the arguments statement. Remember to select the user who has the config file. Also for debugging I have added at the end:
well, the best way is to use a batch file and point task scheduler to that batch file.
that way, you can tweak/test the batch file as needed, run it without task scheduler.
if you want to know about, let me know.
imho, you are free to do as you please, but i always use a batch file.
and when ready, i will point tasksch to that batch file.
if you could suggest a reason not to, let me know?
Imho, you are free to do as you please, but i always use a batch file.
and when ready, i will point tasksch to that batch file.
if you could suggest a reason not to, let me know?
I would still use a batch file (I have to lookup how to make one) but I want to use the script above inside it. That's possible right?
Yes @asdffdsa, I agree the batch script method would be best. I have used a batch script complied to exe but unfortunately virus scanner removed it, so kept it simple for now.
For a one-liner I prefer the easiest method I outlined, but I am developing a more complex batch script for other tasks so will point the scheduled task to a script instead, to use more complex commands, such as log rotation.
Batch scripts in Windows is still new to me as I do a lot more scripting on my NAS box running linux (it mounts my Windows drive and pulls data that way). I used to use dedicated back-up software but prefer the cleaner, more powerful and light-weight rclone instead, hence my dive into scheduled tasks using rclone. Plus the native app encryption is great.