Commit 87641067 authored by Antoine Millet's avatar Antoine Millet

Fixed initscript.

parent ecf84d14
......@@ -26,6 +26,9 @@ GROUP=cc-server
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Override the VERBOSE variable so we always have feedback messages
VERBOSE=yes
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
......@@ -37,10 +40,15 @@ GROUP=cc-server
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
if [ "$ENABLED" = "false" ] ; then
echo "$DESC disabled, see /etc/default/$NAME"
exit 0
fi
# Read and parse configuration variable file if it is present
[ -r /etc/default/$NAME ] && {
. /etc/default/$NAME
# Do not start if service is disabled
if [ "$ENABLED" != "true" ] ; then
echo "$DESC disabled, see /etc/default/$NAME"
exit 0
fi
}
#
# Function that starts the daemon/service
......@@ -55,6 +63,18 @@ do_start()
-- $DAEMON_OPTS || return 2
}
#
# Function that starts the daemon/service
#
do_start()
{
start-stop-daemon --start --quiet --background --name $NAME \
--exec $(readlink -f $(which python)) --test > /dev/null || return 2
start-stop-daemon --start --quiet --background --make-pidfile \
--pidfile $PIDFILE --chuid $USER:$GROUP --exec $DAEMON \
-- $DAEMON_OPTS || return 1
}
#
# Function that stops the daemon/service
#
......@@ -109,20 +129,20 @@ case "$1" in
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
[ "$VERBOSE" != no ] && 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
0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
1) [ "$VERBOSE" != no ] && log_end_msg 1 ;; # Old process is still running
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
[ "$VERBOSE" != no ] && log_end_msg 1
;;
esac
;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment