|
@ -1,5 +1,6 @@ |
|
|
#!/bin/sh /etc/rc.common |
|
|
#!/bin/sh /etc/rc.common |
|
|
# Copyright (C) 2014-2016 nanpuyue <nanpuyue@gmail.com> |
|
|
# Copyright (C) 2014-2016 nanpuyue <nanpuyue@gmail.com> |
|
|
|
|
|
# Copyright (C) 2016 kuoruan <kuoruan@gmail.com> |
|
|
|
|
|
|
|
|
START=99 |
|
|
START=99 |
|
|
SERVICE_WRITE_PID=1 |
|
|
SERVICE_WRITE_PID=1 |
|
@ -61,7 +62,7 @@ start_instance() { |
|
|
config_list_foreach "$s" extra_settings append_extrasettings |
|
|
config_list_foreach "$s" extra_settings append_extrasettings |
|
|
|
|
|
|
|
|
SERVICE_UID="$user" \ |
|
|
SERVICE_UID="$user" \ |
|
|
service_start /usr/bin/aria2c --conf-path="$config_file" |
|
|
|
|
|
|
|
|
service_start /usr/bin/aria2c --conf-path="$config_file" # start service |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
append_extrasettings() { |
|
|
append_extrasettings() { |
|
@ -69,10 +70,24 @@ append_extrasettings() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
start() { |
|
|
start() { |
|
|
|
|
|
logger -t ARIA2C 'Starting aria2c service' |
|
|
config_load 'aria2' |
|
|
config_load 'aria2' |
|
|
config_foreach start_instance 'aria2' |
|
|
config_foreach start_instance 'aria2' |
|
|
|
|
|
return 0 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
stop() { |
|
|
stop() { |
|
|
service_stop /usr/bin/aria2c |
|
|
|
|
|
|
|
|
if [ -n "`pidof aria2c`" ]; then |
|
|
|
|
|
logger -t ARIA2C 'Shutting down aria2c service' |
|
|
|
|
|
service_stop /usr/bin/aria2c |
|
|
|
|
|
fi |
|
|
|
|
|
return 0 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
restart() { |
|
|
|
|
|
logger -t ARIA2C 'Restarting aria2s service' |
|
|
|
|
|
stop |
|
|
|
|
|
sleep 2 # give time to shutdown |
|
|
|
|
|
start |
|
|
|
|
|
} |
|
|
|
|
|
|