summaryrefslogtreecommitdiff
path: root/net/samba/files/samba.sh.sample
blob: 3fca292861b20b30521248c6097645d7d8b7bcc5 (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
#!/bin/sh

rc_file=${0##*/}

if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
        echo "${rc_file}: Cannot determine PREFIX." >&2
        echo "Please use the complete pathname." >&2
        exit 64
fi

smbspool=/var/spool/samba
pidfiledir=/var/run
smbd=${PREFIX}/sbin/smbd
nmbd=${PREFIX}/sbin/nmbd

# start
if [ "x$1" = "x" -o "x$1" = "xstart" ]; then
	if [ -f $smbd ]; then
		if [ -d $smbspool ]; then
			rm -f $smbspool/*
		fi
		echo -n ' Samba'
		$smbd -D
		$nmbd -D
	fi

# stop
elif [ "x$1" = "xstop" ]; then
	kill `cat $pidfiledir/smbd.pid`
	kill `cat $pidfiledir/nmbd.pid`
fi