How can I cancel an Rclone job? Or detect if one is already running?

Hey all,

I’m struggling to work out how I can detect a running Rclone job?

If I try to run the job manually it says it’s already running and if I try to cancel it it says no process found. Am I getting the cancel job command wrong? I was using killall rclone-cron.sh

[pallas ~] ps -fu
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
craftyc+ 12871 0.0 0.0 11792 2764 pts/36 Ss+ 07:10 0:00 /bin/bash -e /u
craftyc+ 12997 2.0 0.2 2528320 271272 pts/36 Sl+ 07:10 10:57 _ /opt/rtorre
craftyc+ 5946 0.0 0.0 21564 4852 pts/297 Ss 16:01 0:00 -bash
craftyc+ 8355 0.0 0.0 38916 3344 pts/297 R+ 16:07 0:00 _ ps -fu
[pallas ~] killall rclone-cron.sh
rclone-cron.sh: no process found
[pallas ~] /media/dma/craftyclown/rclone-cron.sh
/media/dma/craftyclown/rclone-cron.sh already running

You might be better off using pkill rclone-cron.sh which isn’t quite so literal as killall.

Hope that helps!

1 Like

Is it not possible to cancel a job if there are files in the process of being transferred?

I have a backup job that I have decided to cancel and start again using encryption. I have tried cancelling a number of times however the job just carries on going. Is this because there are large files in the process of being moved?

I have tried using the commands;
pkill RichFlix-backup.sh
and
killall RichFlix-backup.sh

and this is the running script;
#!/bin/bash
LOCKFILE="/var/lock/basename $0"

(
flock -n 9 || {
echo “$0 already running”
exit 1
}

/media/dma/craftyclown/bin/rclone copy “gdrive:/The Skull/” “RichFlix:/The Skull/” -v --min-age 1m --log-file=/media/dma/craftyclown/RichFlix-upload.log --bwlimit 8500

) 9>$LOCKFILE

Is there any way to force close it, or do I have to wait it out?

Cheers

1 Like

In Linux/Unix, if you run a ps -ef and grep for the process you are looking for. You can kill it by using the process id in the second column.

felix@gemini:~$ ps -ef | grep rclone
felix     2501     1  6 10:30 ?        00:05:36 /usr/bin/rclone mount gcrypt: /gmedia --allow-other --dir-cache-time 96h --cache-dir /data/rclone --vfs-read-chunk-size 10M --vfs-read-chunk-size-limit 512M --vfs-cache-mode writes --vfs-cache-max-age 6h --buffer-size 512M --syslog --umask 002 --rc --log-level INFO
felix    27335  6438  0 11:59 pts/1    00:00:00 grep rclone

So for me:

kill 2501

and that would kill the running rclone process. Do you have a script or something scheduled that keeps running it?

1 Like

Thanks, using the process ID to kill it worked.

I presume RClone would have eventually closed once the files in mid transfer had completed with the scripting I was using. Does that sound about right?

It should resume any transfers that were in progress.

I can see from the log that these weren’t resumed transfers, they were the same job that wouldn’t cancel until I used the process ID