Register
It is currently Wed Nov 26, 2014 5:01 pm

Samba Server Robust Script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Fri May 16, 2008 6:02 am   

Joined: Fri May 16, 2008 5:54 am
Posts: 1
Hello! This is a simple script, that relaunch samba daemon if it crash.
it is advisable to use "nohup" to run in the background.
Code:
#!/bin/bash
#this script relaunched SMB daemon if he dies unexpectedly
# <pbanegas@gmail.com>

log=/home/user/samba_death.log
mensaje=`echo "El SMB daemon relaunched."`
date=`date`


while true
do
   a=`pidof smbd`     #Pidof in "silent" mode

   if [ $? -eq 0 ]
   then
            #echo OK
      a=0
   else
            #echo ProcessDeath
      /etc/init.d/samba start
      echo "$date : $mensaje" |tee -a $log
      
   fi
   sleep 5
done


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP