Run Aria2c in a screen
#!/bin/sh
#
_rpcs=4321
if [ $(screen -S aria2c -X select . >/dev/null ; echo $?) = 0 ]
then
echo "Aria2c already running...exiting."
exit
fi
mkdir -p /var/log/aria2c /var/local/aria2c
touch -a /var/log/aria2c/aria2c.log
touch -a /var/local/aria2c/aria2c.sess
chown www-data:www-data -R /var/log/aria2c /var/local/aria2c
chmod 770 -R /var/log/aria2c /var/local/aria2c
screen -AmdS aria2c bash -c 'sudo -u www-data aria2c --daemon=false --continue=true --enable-rpc --rpc-secret=$_rpcs --rpc-allow-origin-all --log=/var/log/aria2c/aria2c.log --check-certificate=false --save-session=/var/local/aria2c/aria2c.sess --save-session-interval=2 --input-file=/var/local/aria2c/aria2c.sess --rpc-save-upload-metadata=true --force-save=true --log-level=warn --summary-interval=0 --rpc-listen-all=false --seed-ratio=0.1 --seed-time=0 --max-overall-upload-limit=1k'