From 5246efe3d843cbbf42534e0d20cc6b12d97104cc Mon Sep 17 00:00:00 2001 From: Hsing-Wang Liao Date: Sat, 16 Jul 2016 11:05:57 +0800 Subject: [PATCH] aria2: update init file This update is from #2961, thank @hostkit. Signed-off-by: Hsing-Wang Liao --- net/aria2/Makefile | 2 +- net/aria2/files/aria2.init | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/net/aria2/Makefile b/net/aria2/Makefile index 94e38a3a0f..5e82f15b90 100644 --- a/net/aria2/Makefile +++ b/net/aria2/Makefile @@ -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)/ diff --git a/net/aria2/files/aria2.init b/net/aria2/files/aria2.init index 4205273da0..9d17f4d058 100755 --- a/net/aria2/files/aria2.init +++ b/net/aria2/files/aria2.init @@ -1,5 +1,6 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2014-2016 nanpuyue +# Copyright (C) 2016 kuoruan 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 +} + -- 2.30.2