• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

CentOS hourly Cabal Service check script.

Newbie Spellweaver
Joined
Nov 6, 2011
Messages
32
Reaction score
6
Hey all,

Though I would share this with you. This script will do a force check on all the cabal services and verify that they are running. If one reports as "stopped" it will start it.

Code:
#!/bin/sh


########################################
#   This script was created by xircx   #
#    Hourly check for Cabal services   #
########################################

#Temp file creator
touch /tmp/cabalstatus.tmp
touch /tmp/fname.tmp

#Status Verifier
service cabal status > /tmp/cabalstatus.tmp
while read s; do
  if [[ $s == *stopped* ]];
  then
    echo "$s" | awk '{print $1}' > /tmp/fname.tmp
    service `cat /tmp/fname.tmp` start
    sleep 1
  fi
done < /tmp/cabalstatus.tmp

#Clean Up
rm -rf /tmp/cabalstatus/tmp
rm -rf /tmp/fname.tmp

HowTo:
follow these commands as root:

cd /etc/cron.hourly/
touch cabal_checker
chmod +x cabal_checker
nano cabal_check
paste in the code and press ctrl + x then Y to save and Enter to overwrite.

If you want to test it just stop your server "service cabal stop" and run this script "./cabal_checker".

if all goes good it will start all services.



xircx :thumbup:
 
Back
Top