diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-09-19 11:59:33 -0500 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-09-19 11:59:33 -0500 |
commit | e40531aab32ff93b1f9da20d8a43a440d8dffaca (patch) | |
tree | 837260c74cb8eef56e640ee52b2e329e13719276 /testing/syslog-ng/syslog-ng.rc | |
parent | 6fab33c9210eaa90d0a0179f7e49c339ea88990f (diff) | |
parent | 171f25215eee368fe64f1eed02ce49de090f4b0d (diff) |
Merge branch 'master' of gitpar:abslibre-mips64el
Diffstat (limited to 'testing/syslog-ng/syslog-ng.rc')
-rwxr-xr-x | testing/syslog-ng/syslog-ng.rc | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/testing/syslog-ng/syslog-ng.rc b/testing/syslog-ng/syslog-ng.rc new file mode 100755 index 000000000..516b03da3 --- /dev/null +++ b/testing/syslog-ng/syslog-ng.rc @@ -0,0 +1,66 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +checkconfig() { + if ! syslog-ng -s -f /etc/syslog-ng/syslog-ng.conf; then + stat_fail + exit 1 + fi +} + +pidfile=/run/syslog-ng.pid +if [[ -r $pidfile ]]; then + read -r PID < "$pidfile" + if [[ $PID && ! -d /proc/$PID ]]; then + # stale pidfile + unset PID + rm -f "$pidfile" + fi +fi + +case $1 in + start) + stat_busy "Starting Syslog-NG" + checkconfig + if [[ -z $PID ]] && /usr/sbin/syslog-ng; then + add_daemon syslog-ng + stat_done + else + stat_fail + exit 1 + fi + ;; + stop) + stat_busy "Stopping Syslog-NG" + if [[ $PID ]] && kill $PID &>/dev/null; then + rm_daemon syslog-ng + stat_done + else + stat_fail + exit 1 + fi + ;; + reload) + stat_busy "Reloading Syslog-NG configuration and re-opening log files" + if [[ -z $PID ]]; then + stat_fail + else + checkconfig + if kill -HUP $PID &>/dev/null; then + stat_done + else + stat_fail + exit 1 + fi + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart|reload}" +esac |