Operating System - HP-UX
1827871 Members
1215 Online
109969 Solutions
New Discussion

samba monitor restart script

 
p7
Frequent Advisor

samba monitor restart script

hi all

is there any samba check/restart script that i can put into crontab. one morning i came in and samba was down and it caused mischief. is there any samba check/start/restart script out there that i can just put into cron fro hpux

thx in advance
2 REPLIES 2
Alan Meyer_4
Respected Contributor

Re: samba monitor restart script

[ -z "`ps -ef |grep -v grep |grep smbd`" ] && /sbin/init.d/samba start
[ -z "`ps -ef |grep -v grep |grep nmbd`" ] && /sbin/init.d/samba start
" I may not be certified, but I am certifiable... "
Alan Meyer_4
Respected Contributor

Re: samba monitor restart script

this is actually better...

#!/usr/bin/ksh
if [ -z "`ps -ef |grep -v grep |grep smbd`" ] ;then
/sbin/init.d/samba stop
/sbin/init.d/samba start
elif [ -z "`ps -ef |grep -v grep |grep nmbd`" ] ;then
/sbin/init.d/samba stop
/sbin/init.d/samba start
fi
" I may not be certified, but I am certifiable... "