#!/bin/bash # See programm on mo~eldud ka"ivitamiseks crontabist # Ta ja"lgib yhe teise proge to"o"d ja vajadusel ka"ivitab # selle uuesti # kataloog, kus sees ko~ik toimub HOMEDIR="/home/jaagup/public_html/oma/katse/chat/t2" # fail, kus hoitakse ka"ivitatava protsessi ID-i PIDFILE="blaah.pid" # ka"ivitatava programmi nimi (koos teega) COMMANDTORUN="java" # ka"ivitatava programmi ka"surea parameetrid PARAMETERS="-classpath /home/jaagup/public_html/oma/katse/chat/t2:/usr/lib/java/lib/classes.zip Vastus6 3025" # kui see fail on olemas, siis ei kontrollita midagi DONTCHECKFILE="dont.check" cd $HOMEDIR if [ -f $DONTCHECKFILE ]; then exit 0 fi if [ -r $PIDFILE ] ; then PRGPID=`cat $PIDFILE`; else PRGPID="0" fi if ps hx $PRGPID 2>&1|grep $COMMANDTORUN >/dev/null; then exit 0 ; else $COMMANDTORUN $PARAMETERS & echo $! > $PIDFILE fi exit 0 # the (happy) end -------------------------------------------