build: a more portable way of finding waf in makefiles
[sfrench/samba-autobuild/.git] / packaging / SGI / samba.rc
1 #! /bin/sh
2
3 #
4 # Samba server control
5 #
6
7 IS_ON=/etc/chkconfig
8 KILLALL=/sbin/killall
9
10 SAMBAD=/usr/samba/bin/smbd
11 PROFILE_SAMBAD=/usr/samba/bin/smbd.profile
12 #SAMBA_OPTS=-d2
13 NMBD=/usr/samba/bin/nmbd
14 PROFILE_NMBD=/usr/samba/bin/nmbd.profile
15 #NMBD_OPTS=-d1
16
17 SMBCONTROL=/usr/samba/bin/smbcontrol
18
19 if test ! -x $IS_ON ; then
20     IS_ON=true
21 fi
22
23 if $IS_ON verbose ; then
24     ECHO=echo
25 else            # For a quiet startup and shutdown
26     ECHO=:
27 fi
28
29 if $IS_ON sambaprofiling ; then
30         enable_profiling=yes
31 fi
32
33 if test "$enable_profiling" -o "$1" = "profile" ; then
34         SAMBAD=$PROFILE_SAMBAD
35         NMBD=$PROFILE_NMBD
36         enable_profiling="yes"
37 fi
38
39 case $1 in
40 start|profile)
41         if $IS_ON samba && test -x $SAMBAD; then
42             /etc/init.d/samba stop
43             $ECHO "Samba:\c"
44             $SAMBAD $SAMBA_OPTS -D; $ECHO " smbd\c"
45             $NMBD $NMBD_OPTS -D; $ECHO " nmbd\c"
46             $ECHO "."
47         fi
48         if $IS_ON samba && test "$enable_profiling" ; then
49                 if test -x $SMBCONTROL; then
50                     $ECHO "Enabling Samba profiling."
51                     $SMBCONTROL smbd profile on > /dev/null 2>&1
52                     $SMBCONTROL nmbd profile on > /dev/null 2>&1
53                 fi
54                 $KILLALL -HUP pmcd
55         fi
56         ;;
57 stop)
58         $ECHO "Stopping Samba Servers."
59         $KILLALL -15 smbd nmbd
60         $KILLALL -15 smbd.profile nmbd.profile
61         $KILLALL -15 pmdasamba
62         exit 0
63         ;;
64 *)
65         echo "usage: /etc/init.d/samba {start|stop|profile}"
66         ;;
67 esac