lib/addns: don't depend on the order in resp->answers[]
[Samba.git] / packaging4 / Fedora / samba4.init
bloba04cce92c5953fc699e7894e5b010e207c8813cd
1 #!/bin/sh
3 # chkconfig: - 91 35
4 # description: Starts and stops the Samba smbd daemon \
5 # used to provide SMB network services.
7 # pidfile: /var/run/samba4/smbd.pid
8 # config: /etc/samba4/smb.conf
10 SAMBA_NAME=samba4
12 # Source function library.
13 if [ -f /etc/init.d/functions ] ; then
14 . /etc/init.d/functions
15 elif [ -f /etc/rc.d/init.d/functions ] ; then
16 . /etc/rc.d/init.d/functions
17 else
18 exit 1
21 # Avoid using root's TMPDIR
22 unset TMPDIR
24 # Source networking configuration.
25 . /etc/sysconfig/network
27 if [ -f /etc/sysconfig/$SAMBA_NAME ]; then
28 . /etc/sysconfig/$SAMBA_NAME
31 # Check that networking is up.
32 [ ${NETWORKING} = "no" ] && exit 1
34 # Check that smb.conf exists.
35 [ -f /etc/$SAMBA_NAME/smb.conf ] || exit 6
37 RETVAL=0
40 start() {
41 echo -n $"Starting Samba services: "
42 daemon smbd $SMBDOPTIONS
43 RETVAL=$?
44 echo
45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SAMBA_NAME || \
46 RETVAL=1
47 return $RETVAL
50 stop() {
51 echo -n $"Shutting down Samba services: "
52 killproc smbd
53 RETVAL=$?
54 echo
55 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SAMBA_NAME
56 return $RETVAL
59 restart() {
60 stop
61 start
64 reload() {
65 echo -n $"Reloading smb.conf file: "
66 killproc smbd -HUP
67 RETVAL=$?
68 echo
69 return $RETVAL
72 rhstatus() {
73 status smbd
74 return $?
78 # Allow status as non-root.
79 if [ "$1" = status ]; then
80 rhstatus
81 exit $?
84 # Check that we can write to it... so non-root users stop here
85 [ -w /etc/$SAMBA_NAME/smb.conf ] || exit 4
89 case "$1" in
90 start)
91 start
93 stop)
94 stop
96 restart)
97 restart
99 reload)
100 reload
102 status)
103 rhstatus
105 condrestart)
106 [ -f /var/lock/subsys/$SAMBA_NAME ] && restart || :
109 echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
110 exit 2
111 esac
113 exit $?