#!/bin/ksh # thing_that_runs_and_runs # A script that runs and runs if [ ! -z "$1" ]; then if [ "$1" == "restart" -o "$1" == "stop" ]; then WDOG="cron_check" ONE="thing_that_runs_and_runs" TONE=1 LIST="" while [ "$ONE" == "thing_that_runs_and_runs" ] do CPID=`ps -ef | grep $ONE | grep -v 'grep' | grep -v $WDOG | tail +$TONE | head -1 | sed '/ /s// /g' | sed '/ /s// /g' | sed '/$ /s///g' | cut -d' ' -f 3` if [ $CPID ]; then if [ "$CPID" == "$$" ]; then LIST="$LIST" else LIST="$LIST $CPID" fi TONE=`expr $TONE + 1` else ONE="" fi done if [ ! -z "$LIST" ]; then sudo nohup kill -9 $LIST > /dev/null 2> /dev/null & fi if [ "$1" == "stop" ]; then exit fi fi fi while : do echo "`date`" sleep 60 done exit