You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
add ability to signal rclone to finish current partial task and exit #966
It'd be convenient to be able to signal rclone (perhaps via a SIGUSR1 or SIGUSR2?) to finish up working on the current transfers and then exit so uploads aren't left in a half state. Or perhaps SIGINT? One ctrl-c on the terminal or from external source could tell it to finish up and exit while a second SIGINT would instruct it to exit immediately.
Reacted by Alexander B, aus, Thomas Brichart, gordan-bobic, Evan Harris, Lars Kreisz, Felix Bünemann, pcjonathan, Ryan Mounce, Brian and 19 more
I agree. If you issue the "brake" command you could be presented with, "finish task or abort" this suggestion for those of us who use key strokes or what not to control our screen sessions.
Anothr thing, finish task could be keyed to f and abort could be keyed to a or something like that.
For interactive use I think the first Ctrl+C (SIGINT) for soft abort and second for hard abort works best. For non-interactive use one could probably just send SIGINT for soft abort and SIGTERM for hard abort.
I adhere to this feature request.
Another approach could be to put some "flag" that could be read from time to time, for example if you put a file in the same folder where rclone.exe resides, named stop.txt, after X minutes Rclone could look up if there is the file and then to gracefully stop after end the current file being transfered.
Maybe is not the most elegant solution but it's handy.
I was able to figure out a workaround using socat as a “session manager” for graceful shutdown. example:
rclone serve sftp --addr :8022 local:/my_dir/ can be used to host the /my_dir folder with SFTP socat TCP-LISTEN:2022,fork,reuseaddr TCP-CONNECT:127.0.0.1:8022 was used to proxy connections to the real rclone instance.
socat would start with a certain pid (eg. 150) when an sftp session was opened, socat would “move” the traffic proxy into a new process (eg. 151). Then a SIGTERM signal could be sent to the original process (150) and the container would stop accepting new connections. The child processes can then be monitored using something like ps and will stay open until the client disconnects. Once that happens, the rclone process can be safely terminated.
Activity
ncw commentedon Dec 21, 2016
Nice idea.
martinbowling commentedon Dec 22, 2016
+1
marrie commentedon Dec 28, 2016
I agree. If you issue the "brake" command you could be presented with, "finish task or abort" this suggestion for those of us who use key strokes or what not to control our screen sessions.
Anothr thing, finish task could be keyed to f and abort could be keyed to a or something like that.
kk7ds commentedon Jan 26, 2017
Yes please!
felixbuenemann commentedon Apr 1, 2017
For interactive use I think the first Ctrl+C (SIGINT) for soft abort and second for hard abort works best. For non-interactive use one could probably just send SIGINT for soft abort and SIGTERM for hard abort.
roberdaniel commentedon Sep 28, 2019
I adhere to this feature request.
Another approach could be to put some "flag" that could be read from time to time, for example if you put a file in the same folder where rclone.exe resides, named stop.txt, after X minutes Rclone could look up if there is the file and then to gracefully stop after end the current file being transfered.
Maybe is not the most elegant solution but it's handy.
ncw commentedon Sep 28, 2019
This could be an API call too...
DurvalMenezes commentedon Aug 20, 2020
This would be a great feature to have for some use cases here; I suggest implementing it via the remote control server (ie,
--rc) functionality.ColinHeathman commentedon Aug 15, 2022
I was able to figure out a workaround using
socatas a “session manager” for graceful shutdown. example:rclone serve sftp --addr :8022 local:/my_dir/can be used to host the/my_dirfolder with SFTPsocat TCP-LISTEN:2022,fork,reuseaddr TCP-CONNECT:127.0.0.1:8022was used to proxy connections to the real rclone instance.socat would start with a certain pid (eg. 150) when an sftp session was opened, socat would “move” the traffic proxy into a new process (eg. 151). Then a SIGTERM signal could be sent to the original process (150) and the container would stop accepting new connections. The child processes can then be monitored using something like ps and will stay open until the client disconnects. Once that happens, the rclone process can be safely terminated.
Here's a gist with a basic script that does this: https://gist.github.com/ColinHeathman/ffd441f292a1e42c92835b6d639ec5a5