1. 在 /etc/init.d 中作一个如下内容的脚本smbd
$smbspool=/var/spool/samba
$piddir=/var/run
$smbd=/usr/sbin/smbd
$nmbd=/usr/sbin/nmbd
if [ "x$1" = "x" -o "x$1" = "xstart" ]; then
if [ -d $smbspool ]; then
rm -f $smbspool/*
fi
$smbd -D
$nmbd -D
elif [ "x$1" = "xstop" ]; then
kill `cat $piddir/smbd.pid` #注意,这是“1”键左边的键
kill `cat $piddir/nmbd.pid`
else
echo "$0 start|stop"
fi
2. 然后执行
ln -s /etc/init.d/smbd /etc/rc3.d/S99smbd
ln -s /etc/init.d/smbd /etc/rc0.d/K01smbd
博客介绍了在 /etc/init.d 中创建Samba服务启动与停止脚本 smbd 的内容,启动时会清空相关目录并启动服务,停止时会使用 kill 命令结束进程。还说明了后续执行的操作,即创建软链接到 /etc/rc3.d 和 /etc/rc0.d 目录。
1199

被折叠的 条评论
为什么被折叠?



