summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/rsyslog
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2014-04-17 10:06:49 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2014-04-20 16:10:20 +0200
commit31c10e6dd355ae2ca4f1ba82ca2b227b29731ce1 (patch)
treeb344a7daf0aac6226717ffd247f4b75629b54cc1 /meta-oe/recipes-extended/rsyslog
parentf311d52be6fc84d324c90a1bd7414d013db6eee1 (diff)
downloadmeta-openembedded-31c10e6dd355ae2ca4f1ba82ca2b227b29731ce1.tar.gz
rsyslog: add status command and a minor fix for initscript
- add status command - add --oknodo for do_start Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended/rsyslog')
-rw-r--r--meta-oe/recipes-extended/rsyslog/rsyslog/initscript32
1 files changed, 30 insertions, 2 deletions
diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/initscript b/meta-oe/recipes-extended/rsyslog/rsyslog/initscript
index d011e8f0d..7a8f8f991 100644
--- a/meta-oe/recipes-extended/rsyslog/rsyslog/initscript
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/initscript
@@ -27,7 +27,10 @@ do_start()
27 # Return 27 # Return
28 # 0 if daemon has been started 28 # 0 if daemon has been started
29 # 1 if daemon could not be started 29 # 1 if daemon could not be started
30 start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS || return 1 30 # if daemon had already been started, start-stop-daemon will return 1
31 # so add -o/--oknodo(if nothing is done, exit 0)
32 start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON \
33 --oknodo -- $DAEMON_ARGS || return 1
31} 34}
32# 35#
33# Function that stops the daemon/service 36# Function that stops the daemon/service
@@ -56,6 +59,20 @@ do_reload() {
56 start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME 59 start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME
57 return 0 60 return 0
58} 61}
62
63do_status() {
64 NAME=$1
65 PIDFILE=$2
66 # -t: test only but not stop
67 start-stop-daemon -K -t --quiet --pidfile $PIDFILE --name $NAME
68 # exit with status 0 if process is found
69 if [ "$?" = "0" ]; then
70 return 0
71 else
72 return 1
73 fi
74}
75
59case "$1" in 76case "$1" in
60 start) 77 start)
61 echo -n "starting $RSYSLOGD ... " 78 echo -n "starting $RSYSLOGD ... "
@@ -82,8 +99,19 @@ case "$1" in
82 $0 stop 99 $0 stop
83 $0 start 100 $0 start
84 ;; 101 ;;
102 status)
103 echo -n "status $RSYSLOGD ... "
104 do_status "$RSYSLOGD" "$RSYSLOGD_PIDFILE"
105 if [ "$?" = "0" ]; then
106 echo "running"
107 exit 0
108 else
109 echo "stopped"
110 exit 1
111 fi
112 ;;
85 *) 113 *)
86 echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 114 echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
87 exit 3 115 exit 3
88 ;; 116 ;;
89esac 117esac