Skip to content

Instantly share code, notes, and snippets.

@HeraclesJam
Created February 17, 2017 15:04
Show Gist options
  • Select an option

  • Save HeraclesJam/1979f50c7fcc3d72d4648a1d5d138354 to your computer and use it in GitHub Desktop.

Select an option

Save HeraclesJam/1979f50c7fcc3d72d4648a1d5d138354 to your computer and use it in GitHub Desktop.
讓 aria2 成為背景服務
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO
USER=pi
CONF=/home/pi/aria2.conf
case "$1" in
start)
echo "Starting aria2c service"
umask 0002
su - $USER -c "aria2c --conf-path=$CONF -D"
echo "done !"
;;
stop)
echo "Stopping aria2c service"
sudo killall -w aria2c
echo "done !"
;;
restart)
echo "Restarting aria2c service"
sudo killall -w aria2c
umask 0002
su - $USER -c "aria2c --conf-path=$CONF -D"
echo "done !"
;;
*)
echo "$0 {start|stop|restart}"
;;
esac
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment