You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
865 B
44 lines
865 B
8 years ago
|
#!/bin/sh
|
||
|
|
||
7 years ago
|
. /etc/init.d/globals
|
||
|
|
||
8 years ago
|
SMB_CONF=/etc/samba/smb.conf
|
||
|
|
||
|
case "$1" in
|
||
|
start)
|
||
|
if [ -e /var/etc/.samba ]; then
|
||
|
grep -q "%%NETBIOS_NAME%%" $SMB_CONF
|
||
|
if [ $? -eq 0 ]; then
|
||
|
hwaddr=$(ifconfig eth0 | awk '/HWaddr/ { split($5,v,":"); print v[4] v[5] v[6] }')
|
||
|
sed -i "s|%%NETBIOS_NAME%%|NI-${hwaddr}|" $SMB_CONF
|
||
|
fi
|
||
|
mkdir -p /var/samba/locks
|
||
|
for i in smbd nmbd; do
|
||
|
printf "starting $i ..."
|
||
|
if pidof $i > /dev/null; then
|
||
|
echo " already running"
|
||
|
else
|
||
|
$i
|
||
|
echo "done"
|
||
|
fi
|
||
|
done
|
||
|
fi
|
||
7 years ago
|
;;
|
||
8 years ago
|
stop)
|
||
7 years ago
|
if [ -e /var/etc/.samba ]; then
|
||
|
for i in nmbd smbd; do
|
||
|
printf "stopping $i ..."
|
||
|
if pidof $i > /dev/null; then
|
||
|
read pid < /var/run/${i}.pid
|
||
|
kill $pid && echo "done" || echo "failed!?"
|
||
|
else
|
||
|
echo "not running"
|
||
|
fi
|
||
|
done
|
||
|
fi
|
||
7 years ago
|
;;
|
||
8 years ago
|
*)
|
||
7 years ago
|
echo "[$BASENAME] Usage: $0 {start|stop}"
|
||
|
;;
|
||
8 years ago
|
esac
|