mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-01-27 12:01:38 +01:00
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>
This commit is contained in:
parent
f311d52be6
commit
31c10e6dd3
|
|
@ -27,7 +27,10 @@ do_start()
|
|||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon could not be started
|
||||
start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS || return 1
|
||||
# if daemon had already been started, start-stop-daemon will return 1
|
||||
# so add -o/--oknodo(if nothing is done, exit 0)
|
||||
start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON \
|
||||
--oknodo -- $DAEMON_ARGS || return 1
|
||||
}
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
|
|
@ -56,6 +59,20 @@ do_reload() {
|
|||
start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME
|
||||
return 0
|
||||
}
|
||||
|
||||
do_status() {
|
||||
NAME=$1
|
||||
PIDFILE=$2
|
||||
# -t: test only but not stop
|
||||
start-stop-daemon -K -t --quiet --pidfile $PIDFILE --name $NAME
|
||||
# exit with status 0 if process is found
|
||||
if [ "$?" = "0" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "starting $RSYSLOGD ... "
|
||||
|
|
@ -82,8 +99,19 @@ case "$1" in
|
|||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
echo -n "status $RSYSLOGD ... "
|
||||
do_status "$RSYSLOGD" "$RSYSLOGD_PIDFILE"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "running"
|
||||
exit 0
|
||||
else
|
||||
echo "stopped"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user