Browse Source

aria2: update init file

This update is from #2961, thank @hostkit.

Signed-off-by: Hsing-Wang Liao <kuoruan@gmail.com>
lilik-openwrt-22.03
Hsing-Wang Liao 8 years ago
parent
commit
5246efe3d8
2 changed files with 18 additions and 3 deletions
  1. +1
    -1
      net/aria2/Makefile
  2. +17
    -2
      net/aria2/files/aria2.init

+ 1
- 1
net/aria2/Makefile View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=aria2
PKG_VERSION:=1.24.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/aria2/aria2/releases/download/release-$(PKG_VERSION)/


+ 17
- 2
net/aria2/files/aria2.init View File

@ -1,5 +1,6 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2014-2016 nanpuyue <nanpuyue@gmail.com>
# Copyright (C) 2016 kuoruan <kuoruan@gmail.com>
START=99
SERVICE_WRITE_PID=1
@ -61,7 +62,7 @@ start_instance() {
config_list_foreach "$s" extra_settings append_extrasettings
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() {
@ -69,10 +70,24 @@ append_extrasettings() {
}
start() {
logger -t ARIA2C 'Starting aria2c service'
config_load 'aria2'
config_foreach start_instance 'aria2'
return 0
}
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
}

Loading…
Cancel
Save