From: Tyrel D. <ty...@us...> - 2011-06-08 22:17:27
|
Update of /cvsroot/sblim/cmpi-syslog/syslog-service/util In directory vz-cvs-3.sog:/tmp/cvs-serv12139/syslog-service/util Modified Files: syslog-service.sh syslogserviceutil.c Log Message: Fixed 3287560: Adding rsyslog support for sblim-cmpi-syslog (Patch by Masatake Yamato) Index: syslogserviceutil.c =================================================================== RCS file: /cvsroot/sblim/cmpi-syslog/syslog-service/util/syslogserviceutil.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- syslogserviceutil.c 26 Aug 2009 01:53:54 -0000 1.8 +++ syslogserviceutil.c 8 Jun 2011 22:17:24 -0000 1.9 @@ -79,19 +79,28 @@ svname); if (strcmp(svname, "syslogd")==0) svc->syslogd = pid; if (strcmp(svname, "klogd")==0) svc->klogd = pid; + if (strcmp(svname, "rsyslogd")==0) { + /* rsyslog acts as both syslog and klogd */ + svc->syslogd = svc->klogd = pid; + } if (state) ret = 1; - } - svc->svName = strdup("syslog"); - if (svc && svc->syslogd && svc->klogd) { - svc->svStarted = 1; - svc->svStatus = strdup("OK"); - } - else { - svc->svStarted = 0; - svc->svStatus = strdup("Stopped"); } } + /* rsyslog? */ + svc->svName = strdup("syslog"); } + + if (svc) + { + if (svc->syslogd && svc->klogd) { + svc->svStarted = 1; + svc->svStatus = strdup("OK"); + } + else { + svc->svStarted = 0; + svc->svStatus = strdup("Stopped"); + } + } return ret; } Index: syslog-service.sh =================================================================== RCS file: /cvsroot/sblim/cmpi-syslog/syslog-service/util/syslog-service.sh,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- syslog-service.sh 22 May 2009 03:50:49 -0000 1.5 +++ syslog-service.sh 8 Jun 2011 22:17:24 -0000 1.6 @@ -23,6 +23,8 @@ if [ -f /etc/redhat-release ] then +if [ -x /etc/init.d/syslog ]; +then case "$1" in start) /etc/init.d/syslog start @@ -43,7 +45,38 @@ echo "Unsupported method for RedHat!" exit 0 esac - +elif [ -x /etc/init.d/rsyslog ]; +then +case "$1" in + start) + /etc/init.d/rsyslog start + ;; + stop) + /etc/init.d/rsyslog stop + ;; + restart|reload) + /etc/init.d/rsyslog restart + ;; + condrestart) + /etc/init.d/rsyslog condrestart + ;; + status) + output=`/etc/init.d/rsyslog status` + if echo "$output" | grep Active: | grep inactive > /dev/null 2>&1; then + echo "stopped" + else + pid=`echo "$output" | sed -n -e 's/^[ \t]\+Main PID:[ \t]\+\([0-9]\+\).*/\1/p'` + echo "$pid rsyslog" + fi + ;; + *) + echo "Unsupported method for RedHat!" + exit 0 +esac +else + echo "Neither syslog nor rsyslog found!" + exit 0 +fi elif [ -f /etc/SuSE-release ] then case "$1" in |