[Pkg-samba-maint] Bug#488275: Bug#488275: samba and winbind: initscript miss 'status' option
Tim Stoop
tim at kumina.nl
Mon Jun 30 07:34:17 UTC 2008
Op 28-jun-2008, om 15:25 heeft Christian Perrier het volgende
geschreven:
> I think you're very welcome to propose a patch. We'll review it
> (indeed, Steve will criticize it and I'll just look..:-)) and,
> hopefully, integrate it.
This is my addition to the initscript for samba:
status)
SMBRETURN=3
NMBRETURN=3
PIDS_SMBD=`pidof smbd > /dev/null; echo $?`
PIDS_NMBD=`pidof nmbd > /dev/null; echo $?`
if [ $PIDS_SMBD -gt 0 ]
then
if [ -f $SMBDPID ]
then
echo "smbd not running, pidfile exists!"
SMBRETURN=1
else
echo "smbd not running."
fi
else
if [ -f $SMBDPID ]
then
echo "smbd running"
SMBRETURN=0
else
echo "smbd running, but no pidfile exists!"
# No LSB defined return code for this :(
SMBRETURN=0
fi
fi
if [ $PIDS_NMBD -gt 0 ]
then
if [ -f $NMBDPID ]
then
echo "nmbd not running, pidfile exists!"
NMBRETURN=1
else
echo "nmbd not running."
fi
else
if [ -f $NMBDPID ]
then
echo "nmbd running"
NMBRETURN=0
else
echo "nmbd running, but no pidfile exists!"
# No LSB defined return code for this :(
NMBRETURN=0
fi
fi
if [ $SMBRETURN -eq 1 ] || [ $SMBRETURN -eq 1 ]
then
exit 1
elif [ $SMBRETURN -eq $NMBRETURN ]
then
exit $SMBRETURN
else
# Apparantly, we have an unknown state, or at least something
# that we can't fix easily
return 4
fi
;;
I took some liberties here and it's not really nice code, but it
seems to work in our setup. I believe it's readable.
The same for winbind (much simpler):
status)
PIDS_WINBIND=`pidof winbindd > /dev/null; echo $?`
if [ $PIDS_WINBIND -eq 0 ]
then
echo "winbind is running"
exit 0
else
echo "winbind is stopped"
exit 3
fi
;;
Hope this helps you!
--
Kind regards,
Met vriendelijke groet,
Tim Stoop
Kumina bv
www.kumina.nl
kvk nr 14095795
More information about the Pkg-samba-maint
mailing list