updated on Mon Jan 16 20:00:43 UTC 2012
[aur-mirror.git] / samba-3.5-git / samba.rc
blobbc7d527ef9aa9de7078290a4d5cdc57260f1f54d
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 [ -f /etc/conf.d/samba ] && . /etc/conf.d/samba
7 [ -z "$SAMBA_DAEMONS" ] && SAMBA_DAEMONS=(smbd nmbd)
9 case "$1" in
10 start)
11 rc=0
12 stat_busy "Starting Samba Server"
13 for d in ${SAMBA_DAEMONS[@]}; do
14 PID=`pidof -o %PPID /usr/sbin/$d`
15 [ -z "$PID" ] && /usr/sbin/$d -D
16 rc=$(($rc+$?))
17 done
18 if [ $rc -gt 0 ]; then
19 stat_fail
20 else
21 add_daemon samba
22 stat_done
25 stop)
26 rc=0
27 stat_busy "Stopping Samba Server"
28 for d in ${SAMBA_DAEMONS[@]}; do
29 PID=`pidof -o %PPID /usr/sbin/$d`
30 [ -z "$PID" ] || kill $PID &> /dev/null
31 rc=$(($rc+$?))
32 done
33 if [ $rc -gt 0 ]; then
34 stat_fail
35 else
36 rm /var/run/samba/smbd.pid &>/dev/null
37 rm /var/run/samba/nmbd.pid &>/dev/null
38 rm /var/run/samba/winbindd.pid &>/dev/null
39 rm_daemon samba
40 stat_done
43 restart)
44 $0 stop
45 sleep 1
46 $0 start
49 echo "usage: $0 {start|stop|restart}"
50 esac
51 exit 0