About This Code
Brief Description:
Monitor HTTP-Task on Linux
Notes Version:
R5.x, R6.x
Last Modified:
23 Apr 2004
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
This script check's if the http-Tasks is running, when not it reboots the whole machine.
You can add it in the crontab, i let it run every 15 minutes it works fine!
#! /bin/sh
DIRECTORY=/root
FILE_TEST=/root/index.html
HTTP_TEST=127.0.0.1
cd $DIRECTORY
rm $FILE_TEST
wget $HTTP_TEST
ishere=1
test -r $FILE_TEST || ishere=0
rm $FILE_TEST
date
case "$ishere" in
1)
echo "everything is OK!! -> $HTTP_TEST"
;;
0)
echo "http not available -> reboot $HTTP_TEST"
init 6
;;
esac
Usage / Example