summaryrefslogtreecommitdiffstats
path: root/packaging/HPUX/samba.boot
blob: a0d55d7d76670018b6308ecdd1e3e926bcf621de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

SUCCESS=0
FAILURE=1
exitval=$SUCCESS


KillProcess()
{
  proc=$1
  sig=$2

  # Determine PID of process(es) to stop and kill it.  This routine
  # is designed to work with bourne shell, ksh and posix shell.

  Command=`basename $proc | cut -c1-8`     # Solaris ps limited to 8 chars.

  pid=`ps -e | awk "\\$NF~/$Command/ {print \\$1}"`

  if [ "X$pid" != "X" ]; then
    kill -$sig $pid
  fi
}

if [ ! -f /etc/rc.config.d/samba ]
then
    echo "ERROR: Config file /etc/rc.config.d/samba missing."
    exit $FAILURE
fi

. /etc/rc.config.d/samba

case $1 in
    'start_msg')
        echo "Start Samba Services"
        ;;

    'stop_msg')
        echo "Stop Samba Services"
        ;;

    'start')
        # Starting Samba is easy ...
        if [ "$SAMBA_START" -eq 1 ]
        then
            if [ -x /usr/local/samba/bin/smbd ]
            then
                /usr/local/samba/bin/smbd -D -d $SAMBA_DEBUG
            fi

            if [ -x /usr/local/samba/bin/nmbd ]
            then
                /usr/local/samba/bin/nmbd -D -d $SAMBA_DEBUG
            fi
	fi
        ;;

    'stop')
        #
        # ... stopping it, however, is another story
        #
        KillProcess nmbd TERM
        KillProcess smbd TERM
        ;;

    *)
        echo "usage: $0 {start|stop|start_msg|stop_msg}"
        exitval=$FAILURE
        ;;
esac

exit $exitval