ports/net/samba/files/samba.sh.sample
David W. Chapman Jr. a30a717312 Update to rc4
make rc startup file respect PREFIX
2002-10-16 14:17:03 +00:00

31 lines
602 B
Bash

#!/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