updated on Wed Jan 25 00:20:47 UTC 2012
[aur-mirror.git] / aria2-git / aria2.d
blob90811535e681acb7b0ece48948fe240aeec5ca4c
1 #!/bin/bash
2 . /etc/rc.conf
3 . /etc/rc.d/functions
4 PID=`pidof -o %PPID /usr/bin/aria2c`
5 case "$1" in
6 start)
7 stat_busy "Starting aria2"
9 [ -z "$PID" ] && su -l -s /bin/sh -c "/usr/bin/aria2c --conf-path=/etc/aria2.conf" aria2
10 if [ $? -gt 0 ]; then
11 stat_fail
12 else
13 add_daemon aria2
14 stat_done
17 stop)
18 stat_busy "Stopping aria2"
19 [ ! -z "$PID" ] && kill $PID &> /dev/null
20 if [ $? -gt 0 ]; then
21 stat_fail
22 else
23 rm_daemon aria2
24 stat_done
27 restart)
28 $0 stop
29 while [ ! -z "$PID" -a -d "/proc/$PID" ]; do sleep 1; done
30 $0 start
33 echo "usage: $0 {start|stop|restart}"
34 esac