janitor duty (merges from 3.0) and cleanup compiler warning on SuSE 9 in the end...
[gd/samba/.git] / packaging / Fedora / winbind.init
1 #!/bin/sh
2 #
3 # chkconfig: - 91 35
4 # description: Starts and stops the Samba winbind daemon
5 #              #
6 # pidfile: /var/cache/samba/winbind.pid
7 # config:  /etc/samba/smb.conf
8
9
10 # Source function library.
11 if [ -f /etc/init.d/functions ] ; then
12   . /etc/init.d/functions
13 elif [ -f /etc/rc.d/init.d/functions ] ; then
14   . /etc/rc.d/init.d/functions
15 else
16   exit 0
17 fi
18
19 # Avoid using root's TMPDIR
20 unset TMPDIR
21
22 # Source networking configuration.
23 . /etc/sysconfig/network
24
25 if [ -f /etc/sysconfig/samba ]; then
26    . /etc/sysconfig/samba
27 fi
28
29 # Check that networking is up.
30 [ ${NETWORKING} = "no" ] && exit 0
31
32 # Check that smb.conf exists.
33 [ -f /etc/samba/smb.conf ] || exit 0
34
35 RETVAL=0
36
37
38 start() {
39         KIND="Winbind"
40         echo -n $"Starting $KIND services: "
41         daemon winbindd "$WINBINDOPTIONS"
42         RETVAL=$?
43         echo
44         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbindd || RETVAL=1
45         return $RETVAL
46 }       
47
48 stop() {
49         echo
50         KIND="Winbind"
51         echo -n $"Shutting down $KIND services: "
52         killproc winbindd -TERM
53         RETVAL=$?
54         [ $RETVAL -eq 0 ] \
55                 && && rm -f /var/run/nmbd.pid \ 
56                 && rm -f /var/lock/subsys/winbindd
57         echo ""
58         return $RETVAL
59 }       
60
61 restart() {
62         stop
63         start
64 }       
65
66 reload() {
67         echo -n $"Reloading smb.conf file: "
68         killproc winbindd -HUP
69         RETVAL=$?
70         echo
71         return $RETVAL
72 }       
73
74 rhstatus() {
75         status winbindd
76 }       
77
78 case "$1" in
79   start)
80         start
81         ;;
82   stop)
83         stop
84         ;;
85   restart)
86         restart
87         ;;
88   reload)
89         reload
90         ;;
91   status)
92         rhstatus
93         ;;
94   condrestart)
95         [ -f /var/lock/subsys/winbindd ] && restart || :
96         ;;
97   *)
98         echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
99         exit 1
100 esac
101
102 exit $?