]> git.pld-linux.org Git - packages/samba.git/blob - smb.init
-i fixed libmbclient, rel.6.
[packages/samba.git] / smb.init
1 #!/bin/sh
2 #
3 # chkconfig:    345 91 35
4 # description:  Starts and stops the Samba smbd and nmbd daemons \
5 #               used to provide SMB network services.
6 #
7 # config:       /etc/samba/smb.conf
8 # config:       /etc/samba/lmhosts
9
10 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
11
12 # Source function library.
13 . /etc/rc.d/init.d/functions
14
15 # Source networking configuration.
16 . /etc/sysconfig/network
17
18 # Demon specified configuration.
19 . /etc/sysconfig/samba
20
21 # Check that networking is up.
22 if is_no "${NETWORKING}"; then
23         msg_Network_Down smb
24         exit 1
25 fi
26
27 TMPDIR="/tmp"; export TMPDIR
28
29 # Check that smb.conf exists.
30 [ -f /etc/samba/smb.conf ] || exit 0
31
32 # See how we were called.
33 case "$1" in
34   start)
35         # Check if the service is already running?
36         if [ ! -f /var/lock/subsys/smb ]; then
37                 msg_starting smbd
38                 daemon $NICELEVEL smbd -D
39                 msg_starting nmbd
40                 daemon $NICELEVEL nmbd -D
41                 if [ "$WINBINDD" = "yes" ]; then
42                         msg_starting winbindd
43                         daemon $NICELEVEL winbindd
44                 fi
45                 RETVAL=$?
46                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb
47         else
48                 msg_Already_Running smb
49                 exit 1
50         fi
51         ;;
52   stop)
53         # Stop daemons.
54         if [ -f /var/lock/subsys/smb ]; then
55                 msg_stopping smbd
56                 killproc smbd
57                 msg_stopping nmbd
58                 killproc nmbd
59                 if [ "$WINBINDD" = "yes" ]; then
60                         msg_stopping winbindd
61                         killproc winbindd
62                 fi
63                 rm -f /var/lock/subsys/smb >/dev/null 2>&1
64         else
65                 msg_Not_Running smb
66                 exit 1
67         fi
68         ;;
69   status)
70         status smbd
71         status nmbd
72         status winbindd
73         smbstatus
74         exit $?
75         ;;
76   restart)
77         $0 stop
78         $0 start
79         ;;
80   reload)
81         if [ -f /var/lock/subsys/smb ]; then
82                 msg_reloading smb
83                 killproc smbd -HUP
84         else
85                 msg_Not_Running smb
86                 exit 1
87         fi
88         ;;
89   *)
90         msg_Usage "$0 {start|stop|restart|reload|status}"
91         exit 1
92 esac
93
94 exit $RETVAL
This page took 0.032451 seconds and 3 git commands to generate.