S01logging 573 Bytes
#!/bin/sh

start() {
	printf "Starting syslog-ng daemon: "
	start-stop-daemon -S -q -p /var/run/syslog-ng.pid \
		-x /usr/sbin/syslog-ng -- --pidfile /var/run/syslog-ng.pid
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}

stop() {
	printf "Stopping syslog-ng daemon: "
	start-stop-daemon -K -q -p /var/run/syslog-ng.pid \
		-x /usr/sbin/syslog-ng
	[ $? = 0 ] && echo "OK" || echo "FAIL"
}

restart() {
	stop
	sleep 1
	start
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart|reload)
		restart
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac

exit $?