~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/samba

  • Committer: Dimitri John Ledkov
  • Date: 2014-05-06 18:45:46 UTC
  • Revision ID: dimitri.ledkov@canonical.com-20140506184546-5toyx56xxrue0f0v
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
### BEGIN INIT INFO
 
4
# Provides:          samba
 
5
# Required-Start:    smbd nmbd
 
6
# Required-Stop:     smbd nmbd
 
7
# Default-Start:     
 
8
# Default-Stop:      
 
9
# Short-Description: ensure Samba daemons are started (nmbd and smbd)
 
10
### END INIT INFO
 
11
 
 
12
set -e
 
13
 
 
14
# start nmbd, smbd and samba-ad-dc unconditionally
 
15
# the init scripts themselves check if they are needed or not
 
16
case $1 in
 
17
        start)
 
18
                /etc/init.d/nmbd start
 
19
                /etc/init.d/smbd start
 
20
                /etc/init.d/samba-ad-dc start
 
21
                ;;
 
22
        stop)
 
23
                /etc/init.d/samba-ad-dc stop
 
24
                /etc/init.d/smbd stop
 
25
                /etc/init.d/nmbd stop
 
26
                ;;
 
27
        reload)
 
28
                /etc/init.d/smbd reload
 
29
                ;;
 
30
        restart|force-reload)
 
31
                /etc/init.d/nmbd "$1"
 
32
                /etc/init.d/smbd "$1"
 
33
                /etc/init.d/samba-ad-dc "$1"
 
34
                ;;
 
35
        status)
 
36
                status=0
 
37
                NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null || true`
 
38
                SERVER_ROLE=`samba-tool testparm --parameter-name="server role"  2>/dev/null | tail -1 || true`
 
39
                if [ "$SERVER_ROLE" != "active directory domain controller" ]; then
 
40
                        if [ "$NMBD_DISABLED" != "Yes" ]; then
 
41
                                /etc/init.d/nmbd status || status=$?
 
42
                        fi
 
43
                        /etc/init.d/smbd status || status=$?
 
44
                else
 
45
                        /etc/init.d/samba-ad-dc status || status=$?
 
46
                fi
 
47
                exit $status
 
48
                ;;
 
49
        *)
 
50
                echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}"
 
51
                exit 1
 
52
                ;;
 
53
esac