]> git.meshlink.io Git - catta/blobdiff - initscript/debian/avahi-daemon.in
* apply patches from debian pacakge
[catta] / initscript / debian / avahi-daemon.in
index feecc847a8b70f903b41c6e63b678949103f6696..3145f3aef0cb227ea554e99f0e935d8a230a195b 100755 (executable)
@@ -91,6 +91,11 @@ test -x $DAEMON || exit 0
 #       Function that starts the daemon/service.
 #
 d_start() {
+    modprobe capability >/dev/null 2>&1 || true
+
+    $DAEMON -c
+    [ $? = 0 ] && exit 0
+
     if [ -s /etc/localtime ]; then
        if [ ! -d /etc/avahi/etc ]; then
            mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
@@ -105,16 +110,29 @@ d_start() {
 #       Function that stops the daemon/service.
 #
 d_stop() {
-    $DAEMON -k || /bin/true
+    $DAEMON -c
+    [ $? != 0 ] && exit 0
+
+    $DAEMON -k
 }
 
 #
 #       Function that reload the config file for the daemon/service.
 #
 d_reload() {
+    $DAEMON -c
+    [ $? != 0 ] && exit 0
+
     $DAEMON -r
 }
 
+#
+#       Function that check the status of the daemon/service.
+#
+d_status() {
+    $DAEMON -c
+    [ $? = 0 ]  && echo "$DESC is running" || echo "$DESC is not running"
+}
 
 case "$1" in
     start)
@@ -134,11 +152,14 @@ case "$1" in
         ;;
     restart|force-reload)
         log_begin_msg "Restarting $DESC: $NAME"
-        d_stop
+        $DAEMON -c && d_stop
         d_start
         log_end_msg $?
         ;;
-  *)
+    status)
+        d_status
+       ;;
+    *)
         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
         exit 1
         ;;