#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO
NAME=aria2c
USER=wzhy90
ARIA2C=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
CONF=/home/$USER/.aria2/aria2.conf
ARGS="--conf-path=${CONF}"
test -f $ARIA2C || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting aria2c."
if [ -e "$PIDFILE" ]; then
log_warning_msg "aria2c is already running."
else
start-stop-daemon -S -q -b -m -p $PIDFILE -c $USER -a $ARIA2C -- $ARGS
log_end_msg $?
fi
;;
stop)
log_daemon_msg "Stopping aria2c."
if [ -e "$PIDFILE" ]; then
start-stop-daemon -K -q -p $PIDFILE
rm $PIDFILE
log_end_msg $?
else
log_warning_msg "aria2c is not running."
fi
;;
restart|reload|force-reload)
log_daemon_msg "Restarting aria2c."
if [ -e "$PIDFILE" ]; then
start-stop-daemon -K -R 5 -q -p $PIDFILE
start-stop-daemon -S -q -b -m -p $PIDFILE -c $USER -a $ARIA2C -- $ARGS
log_end_msg $?
else
log_warning_msg "aria2c is not running."
fi
;;
status)
status_of_proc -p $PIDFILE $ARIA2C aria2c && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/aria2c {start|stop|restart|reload|force-reload|status}"
exit 2
;;
esac
exit 0
小黑屋|手机版|Archiver|万博网页版登陆页派论坛 ( 粤ICP备15075382号-1 )
GMT+8, 2024-11-1 14:34 , Processed in 1.140625 second(s), 20 queries , Gzip On.
Powered by Shumeipai.net! X3.2
© 2001-2015 万博网页版登陆页派论坛,安全联盟