]> git.pld-linux.org Git - packages/samba.git/blobdiff - smb.init
- more specific Requires
[packages/samba.git] / smb.init
index bbda003c4ef918145d799e048825a7f6a9c64717..83e73b4bc9ef8536c2010f86e3c5844548613cb5 100644 (file)
--- a/smb.init
+++ b/smb.init
@@ -1,8 +1,11 @@
-#!/bin/bash
+#!/bin/sh
 #
-# chkconfig: 345 91 35
-# description: Starts and stops the Samba smbd and nmbd daemons \
-#             used to provide SMB network services.
+# chkconfig:   345 91 35
+# description: Starts and stops the Samba smbd and nmbd daemons \
+#              used to provide SMB network services.
+#
+# config:      /etc/samba/smb.conf
+# config:      /etc/samba/lmhosts
 
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 
@@ -16,7 +19,12 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 . /etc/sysconfig/samba
 
 # Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
+if is_no "${NETWORKING}"; then
+        msg_Network_Down smb
+        exit 1
+fi
+
+TMPDIR="/tmp"; export TMPDIR
 
 # Check that smb.conf exists.
 [ -f /etc/samba/smb.conf ] || exit 0
@@ -24,30 +32,63 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 # See how we were called.
 case "$1" in
   start)
-       show Starting smbd
-       daemon $NICELEVEL smbd -D       
-       show Starting nmbd
-       daemon $NICELEVEL nmbd -D 
-       touch /var/lock/subsys/smb
+        # Check if the service is already running?
+        if [ ! -f /var/lock/subsys/smb ]; then
+                msg_starting smbd
+                daemon $NICELEVEL smbd -D
+                msg_starting nmbd
+                daemon $NICELEVEL nmbd -D
+               if [ "$WINBINDD" = "yes" ]; then
+                       msg_starting winbindd
+                       daemon $NICELEVEL winbindd
+               fi
+                RETVAL=$?
+                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb
+        else
+                msg_Already_Running smb
+                exit 1
+        fi
        ;;
   stop)
-       show Shutting down smbd
-       killproc smbd
-       show Shutting down nmbd
-       killproc nmbd
-       rm -f /var/lock/subsys/smb
+        # Stop daemons.
+        if [ -f /var/lock/subsys/smb ]; then
+                msg_stopping smbd
+                killproc smbd
+                msg_stopping nmbd
+               killproc nmbd
+               if [ "$WINBINDD" = "yes" ]; then
+                       msg_stopping winbindd
+                       killproc winbindd
+               fi
+                rm -f /var/lock/subsys/smb >/dev/null 2>&1
+        else
+                msg_Not_Running smb
+                exit 1
+        fi
        ;;
   status)
        status smbd
        status nmbd
+       status winbindd
        smbstatus
+       exit $?
        ;;
   restart)
        $0 stop
        $0 start
        ;;
+  reload)
+       if [ -f /var/lock/subsys/smb ]; then
+               msg_reloading smb
+               killproc smbd -HUP
+       else
+               msg_Not_Running smb
+               exit 1
+        fi
+       ;;
   *)
-       echo "Usage: $0 {start|stop|restart|status}"
+       msg_Usage "$0 {start|stop|restart|reload|status}"
        exit 1
 esac
 
+exit $RETVAL
This page took 0.096252 seconds and 4 git commands to generate.