]> git.pld-linux.org Git - packages/samba.git/blob - winbind.init
up to 4.20.1
[packages/samba.git] / winbind.init
1 #!/bin/sh
2 #
3 # chkconfig:    345 91 35
4 # description:  Starts and stops the Samba winbind daemon to provide\
5 #               user and group information from a NT domain controller to linux.
6 #
7 # config:       /etc/samba/smb.conf
8 # processname:  winbindd
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 winbindd_pidfile="/var/run/samba/winbindd.pid"
19
20 # Daemon specific configuration.
21 . /etc/sysconfig/winbind
22
23 # Check that networking is up.
24 if is_yes "${NETWORKING}"; then
25         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
26                 msg_network_down winbindd
27                 exit 1
28         fi
29 else
30         exit 0
31 fi
32
33 TMPDIR="/tmp"; export TMPDIR
34
35 # Check that smb.conf exists.
36 [ -f /etc/samba/smb.conf ] || exit 0
37
38 start() {
39         if [ ! -f /var/lock/subsys/winbind ]; then
40                 msg_starting winbindd
41                 daemon /usr/sbin/winbindd
42                 RETVAL=$?
43                 if [ $RETVAL -eq 0 ]; then
44                         touch /var/lock/subsys/winbind
45                         RETVAL=1
46                 fi
47         else
48                 msg_already_running winbindd
49         fi
50 }
51
52 stop() {
53         if [ -f /var/lock/subsys/winbind ]; then
54                 msg_stopping winbindd
55                 killproc --pidfile $winbindd_pidfile winbindd
56                 rm -f /var/lock/subsys/winbind >/dev/null 2>&1
57         else
58                 msg_not_running winbindd
59         fi
60 }
61
62 condrestart() {
63         if [ -f /var/lock/subsys/winbind ]; then
64                 stop
65                 start
66         else
67                 msg_not_running winbindd
68                 RETVAL=$1
69         fi
70 }
71
72 RETVAL=0
73 # See how we were called.
74 case "$1" in
75   start)
76         start
77         ;;
78   stop)
79         stop
80         ;;
81   restart)
82         stop
83         start
84         ;;
85   reload|force-reload)
86         if [ -f /var/lock/subsys/winbind ]; then
87                 msg_reloading winbindd
88                 killproc --pidfile $winbindd_pidfile winbindd -HUP
89                 RETVAL=$?
90         else
91                 msg_not_running winbindd
92                 exit 7
93         fi
94         ;;
95   try-restart)
96         condrestart 0
97         ;;
98   status)
99         status winbindd
100         RETVAL=$?
101         ;;
102   *)
103         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
104         exit 3
105 esac
106
107 exit $RETVAL
This page took 0.032841 seconds and 3 git commands to generate.