I am currently running aria2 in daemon mode in order to control it via xml-rpc commands. The addition of files via xml-rpc works fine. The problem I am trying to solve is how to get aria2 to resume the "session" if it is stopped abruptly, rather than gracefully.
I'm using the setting "save-session-interval" described in the manual here in order to attempt to get aria to save to the session file at an interval. If I interrupt aria via a ctrl-c interrupt it gracefully saves the pending downloads into the session file. After which if I restart aria via the same command, it resumes the downloads correctly.
Every 20seconds aria2 writes to the console saying that it has serialized the session. Notepad++ even detects that the file has been changed, however the file remains empty.
07/11 22:49:54 [NOTICE] Serialized session to 'C:\temp\aria\session.txt' successfully.
The command I am using to start aria:
aria2c.exe --conf-path=C:\temp\aria\aria.conf --daemon
The contents of the conf file are:
dir=C:\temp\aria
input-file=C:\temp\aria\session.txt
save-session=C:\temp\aria\session.txt
enable-rpc=true
save-session-interval=20
The xml-rpc command I am using is being called from python like so:
import xmlrpclib
fileurl = "http://example.com/sample_file.txt"
s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
val = s.aria2.addUri([fileurl], {'http-user':'user', 'http-passwd':'pass'})
An additional thing I've tried is to empty the session file after stopping aria gracefully (allowing it to write the pending download to the session file). It then overrides the session file with the download. This behavior points me to believe that aria does not save downloads added via xml-rpc into the "session" list for saving to the session file.
I've also tried adding the "save-session-interval" to the initial command instead of the conf file but the behavior is identical.
Aria Version Details:
aria2 version 1.17.1
I am using the below conf file with aria running as deamon and it works fine :
dir=/media/ExternalHd/aria
file-allocation=falloc
continue
log-level=error
max-connection-per-server=4
summary-interval=120
daemon=true
enable-rpc=true
rpc-listen-port=6800
rpc-listen-all=true
max-concurrent-downloads=2
save-session=/home/pi/Desktop/aria.txt
input-file=/home/pi/Desktop/aria.txt
log=/home/pi/Desktop/aria.log
disable-ipv6=true
disk-cache=25M
timeout=600
retry-wait=30
max-tries=50
save-session-interval=10
Try using the above config and run aria2c as deamon, you can also use the various methods to access the aria2c RPC interface as detailed here from desktop and mobile devices. I am using the mobile app and web-interface and it saves the session with aria2c v 1.16.5