#!/bin/sh
### BEGIN INIT INFO
# Provides:          Aria2
# Short-Description: Aria2 - Download Manager
# Description:       Aria2 - Download Manager
### END INIT INFO

RETVAL=0

case "$1" in
        start)
                echo -n "Starting aria2c daemon: "
                umask 0000
                /opt/bin/aria2c --conf-path=/opt/etc/dm2_aria2/aria2.conf -D
                RETVAL=$?
                echo
                ;;
        stop)
                echo -n "Shutting down aria2c daemon: "
                killall aria2c
                RETVAL=$?
                echo
                ;;
        restart)
                $0 stop
                sleep 3
                $0 start
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart}"
                RETVAL=1                             
esac                                                 
                                                     
exit $RETVAL