samba/samba-initscript

58 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# Copyright (c) 2003-2007 Silvan Calarco <ilvan.calarco@mambasotf@org>
# Copyright (c) 2007 Davide Madrisan <davide.madrisan@gmail.com>
#
# chkconfig: 2345 55 15
# description: start Samba daemons (nmbd and smbd)
. /etc/sysconfig/rc
. $rc_functions
NAME=samba
NMBD=/usr/sbin/nmbd
SMBD=/usr/sbin/smbd
NMBDPID=/run/nmbd.pid
SMBDPID=/run/smbd.pid
[ -x $SMBD -a -x $NMBD ] || exit 0
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
case "$1" in
start)
echo -n "Starting nmbd: "
daemon --pidfile=$NMBDPID $NMBD -D
evaluate_retval; echo
echo -n "Starting smbd: "
daemon --pidfile=$SMBDPID $SMBD -D
evaluate_retval; echo
;;
stop)
echo -n "Stopping nmbd: "
killproc -p $NMBDPID $NMBD -TERM
echo
sleep 1
echo -n "Stopping smbd: "
killproc -p $SMBDPID $SMBD -TERM
echo
;;
reload)
echo -n "Reloading smbd: "
reloadproc $SMBD
echo
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
status)
statusproc $NMBD
statusproc $SMBD
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|status}"
exit 1
;;
esac