Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

example: fix status and restart for init.d

Signed-off-by: Laurent Arnoud <laurent.arnoud@af83.com>
Signed-off-by: Julien Boyer <julien.boyer@af83.com>
  • Loading branch information...
commit 1d4ef4f971be5951198f7a1cb73cd61a551e23dc 1 parent 8641404
@spk spk authored
Showing with 13 additions and 18 deletions.
  1. +13 −18 examples/pids.init.d.sh
View
31 examples/pids.init.d.sh
@@ -43,7 +43,7 @@ SCRIPTNAME=/etc/init.d/$NAME
do_start()
{
su -l -c "source $PROFILE; $DAEMON start -d" $APP_USER
- RETVAL="$?"
+ RETVAL="$?"
return "$RETVAL"
}
@@ -53,10 +53,19 @@ do_start()
do_stop()
{
su -l -c "source $PROFILE; $DAEMON stop" $APP_USER
- RETVAL="$?"
+ RETVAL="$?"
return "$RETVAL"
}
+#
+# Function that restarts the daemon/service
+#
+do_restart()
+{
+ su -l -c "source $PROFILE; $DAEMON restart" $APP_USER
+ RETVAL="$?"
+ return "$RETVAL"
+}
case "$1" in
start)
@@ -76,7 +85,7 @@ case "$1" in
esac
;;
status)
- status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ status_of_proc "${NAME}_supervisor" && exit 0 || exit $?
;;
restart|force-reload)
#
@@ -84,21 +93,7 @@ case "$1" in
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
+ do_restart
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
Please sign in to comment.
Something went wrong with that request. Please try again.