From: Florian Fainelli Date: Fri, 18 Jan 2013 16:34:34 +0000 (+0000) Subject: vnstat: update init script to use latest service functions X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ed1df976976fcecd934ecd206eb41647faeea531;p=openwrt%2Fsvn-archive%2Fpackages.git vnstat: update init script to use latest service functions This is just a simple patch to update vnstatd to use the latest service functions. Signed-off-by: Joe Roback Signed-off-by: Florian Fainelli SVN-Revision: 35233 --- diff --git a/net/vnstat/files/vnstat.init b/net/vnstat/files/vnstat.init index fab1f341a..802e60b06 100644 --- a/net/vnstat/files/vnstat.init +++ b/net/vnstat/files/vnstat.init @@ -65,13 +65,18 @@ start() { config_load vnstat config_foreach init_ifaces vnstat - /usr/sbin/vnstatd -d + SERVICE_PID_FILE="${pid}" + service_start /usr/sbin/vnstatd -d } stop() { local pid="$(vnstat_option PidFile)" - [ -n "$pid" ] && { - service_kill vnstatd "$pid" - rm -f "$pid" + + [ -n "$pid" ] || { + echo "Error: No PidFile set in vnstat.conf" >&2 + exit 1 } + + SERVICE_PID_FILE="${pid}" + service_stop /usr/sbin/vnstatd }