syslog-ng: Use procd style init
authorMichal Hrusecky <michal.hrusecky@nic.cz>
Mon, 4 Sep 2017 07:50:40 +0000 (09:50 +0200)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Thu, 17 Jan 2019 23:18:21 +0000 (00:18 +0100)
Signed-off-by: Michal Hrusecky <michal.hrusecky@nic.cz>
admin/syslog-ng/files/syslog-ng.init

index bb03de67229613753f5b8f78607a35a83813a163..7b9488b2806dc78ee149d98a4d3835db5c7402cd 100644 (file)
@@ -1,31 +1,18 @@
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2006-2016 OpenWrt.org
 
-START=20
-PROG=/usr/sbin/syslog-ng
-PROG2=/usr/sbin/syslog-ng-ctl
+START=50
 
-SERVICE_USE_PID=1
-SERVICE_PID_FILE=/var/run/syslog-ng.pid
+USE_PROCD=1
 
-config_file=/etc/syslog-ng.conf
-
-start() {
-       [ -f $config_file ] || return 1
-
-       if ! $PROG -s 2>/dev/null ; then
-               echo "Couldn't parse $(basename $config_file)" >&2
-               exit 1
-       fi
-
-       service_start $PROG --process-mode background \
-               -p $SERVICE_PID_FILE
-}
-
-stop() {
-       service_stop $PROG
+start_service() {
+       [ -f /etc/syslog-ng.conf ] || return 1
+       procd_open_instance
+       procd_set_param command /usr/sbin/syslog-ng
+       procd_close_instance
 }
 
-reload() {
-       $PROG2 reload
+reload_service() {
+        stop
+        start
 }