iro/merlin
author Sandro Knauß <knauss@netzguerilla.net>
Sat, 08 Oct 2011 12:32:58 +0200
changeset 66 eabb8ead183d
parent 0 a3b6e531f0d2
permissions -rwxr-xr-x
Added dump_test_log.py from http://hieuhacking.blogspot.com/2009/09/log-rotation-for-python-process.html Added testloglock.py from http://cherrypy.org/attachment/ticket/679/testloglock.py

#!/bin/bash
#
# merlin commando
#
# eine überprüfung auf korrekten aufruf findet nicht statt
#
# beispiel:
#
#       ./merlin ./arthur
#
#               startet programm arthur und wenn er stirbt, wird er sofort
#               wiederbelebt.
#               harmlose magie halt... :-)
#
LOG=/home/sandy/var/log/merlin_Iro.log
while : ; do
	echo -n "$(date +'%F %T %Z') " >> $LOG
	$1 status >> $LOG
	if [ $? -eq 1 ]; then
		echo $(date +'%F %T %Z') $1 neustarten >> $LOG
		$1 start >> $LOG
	fi
	sleep 60
done