Created
February 17, 2017 15:04
-
-
Save HeraclesJam/1979f50c7fcc3d72d4648a1d5d138354 to your computer and use it in GitHub Desktop.
讓 aria2 成為背景服務
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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