]> git.pld-linux.org Git - packages/samba.git/blob - smb.init
- rewrited with new functions
[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
28 # Check that smb.conf exists.
29 [ -f /etc/samba/smb.conf ] || exit 0
30
31 # See how we were called.
32 case "$1" in
33   start)
34         # Check if the service is already running?
35         if [ ! -f /var/lock/subsys/smb ]; then
36                 msg_starting smbd
37                 daemon $NICELEVEL smbd -D
38                 msg_starting nmbd
39                 daemon $NICELEVEL nmbd -D
40                 RETVAL=$?
41                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb
42         else
43                 msg_Already_Running smb
44                 exit 1
45         fi
46         ;;
47   stop)
48         # Stop daemons.
49         if [ -f /var/lock/subsys/smb ]; then
50                 msg_stopping smbd
51                 killproc smbd
52                 msg_stopping nmbd
53                 killproc nmbd
54                 rm -f /var/lock/subsys/smb >/dev/null 2>&1
55         else
56                 msg_Not_Running smb
57                 exit 1
58         fi
59         ;;
60   status)
61         status smbd
62         status nmbd
63         smbstatus
64         exit $?
65         ;;
66   restart)
67         $0 stop
68         $0 start
69         ;;
70   reload)
71         if [ -f /var/lock/subsys/smb ]; then
72                 msg_reload smb
73                 killproc smbd -HUP
74         else
75                 msg_Not_Running smb
76                 exit 1
77         fi
78         ;;
79   *)
80         msg_Usage "$0 {start|stop|restart|reload|status}"
81         exit 1
82 esac
83
84 exit $RETVAL
This page took 0.03567 seconds and 4 git commands to generate.