Created
November 4, 2014 06:29
-
-
Save dishuostec/023d12bf9dafee48d871 to your computer and use it in GitHub Desktop.
init.d file for aria2c daemon (centos)
This file contains 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 | |
# | |
# aria2 ariac server | |
# | |
# chkconfig: 345 70 30 | |
# description: ariac server | |
# processname: aria2c | |
Prgmname="/usr/bin/aria2c" | |
shortname="aria2c" | |
#one option | |
options="--conf-path=" | |
# configfile=/full_path/configfile | |
configfile="/etc/aria2/aria2.conf" | |
start() { | |
# Code here to start the program | |
logger -t ARIA2C "Starting aria2c daemon " | |
${Prgmname} ${options}${configfile} | |
sleep 5 | |
return 0 | |
} | |
stop() { | |
# Code here to stop the program and check it's dead | |
if [ -n "`pidof $shortname`" ]; then | |
logger -t ARIA2C "Shutting down aria2c daemon " | |
/usr/bin/killall $shortname | |
sleep 5 | |
fi | |
return 0 | |
} | |
##########################start here########################## | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
logger -t ARIA2C "$shortname restart, executed from $(whoami)" | |
stop | |
sleep 2 | |
start | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart}" | |
exit 1 | |
esac | |
sleep 1 | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment