• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/arm-none-eabi/include/c++/4.6.1/bits/
1
2SUCCESS=0
3FAILURE=1
4exitval=$SUCCESS
5
6
7KillProcess()
8{
9  proc=$1
10  sig=$2
11
12  # Determine PID of process(es) to stop and kill it.  This routine
13  # is designed to work with bourne shell, ksh and posix shell.
14
15  Command=`basename $proc | cut -c1-8`     # Solaris ps limited to 8 chars.
16
17  pid=`ps -e | awk "\\$NF~/$Command/ {print \\$1}"`
18
19  if [ "X$pid" != "X" ]; then
20    kill -$sig $pid
21  fi
22}
23
24if [ ! -f /etc/rc.config.d/samba ]
25then
26    echo "ERROR: Config file /etc/rc.config.d/samba missing."
27    exit $FAILURE
28fi
29
30. /etc/rc.config.d/samba
31
32case $1 in
33    'start_msg')
34        echo "Start Samba Services"
35        ;;
36
37    'stop_msg')
38        echo "Stop Samba Services"
39        ;;
40
41    'start')
42        # Starting Samba is easy ...
43        if [ "$SAMBA_START" -eq 1 ]
44        then
45            if [ -x /opt/samba/bin/smbd ]
46            then
47                /opt/samba/bin/smbd -D -d $SAMBA_DEBUG
48            fi
49
50            if [ -x /opt/samba/bin/nmbd ]
51            then
52                /opt/samba/bin/nmbd -D -d $SAMBA_DEBUG
53            fi
54	fi
55        ;;
56
57    'stop')
58        #
59        # ... stopping it, however, is another story
60        #
61        KillProcess nmbd TERM
62        KillProcess smbd TERM
63        ;;
64
65    *)
66        echo "usage: $0 {start|stop|start_msg|stop_msg}"
67        exitval=$FAILURE
68        ;;
69esac
70
71exit $exitval
72
73