(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

7. Testing the program - monitor_test

From your browser save this file as text-file named as 'monitor_test'.

Use this program for testing the 'procautostart' program. For example -


        procautostart -n 12 -c "monitor_test -d $HOME  -a dummy_arg " nohup &

Here procautostart will be checking the process monitor_test every 12 seconds.


#!/bin/ksh

# Program to test the procautostart

echo "Started the monitor_test ...."
date > monitor_test.log
while :
do
        date >> monitor_test.log
        sleep 2
done

Then do a tail command to monitor the output. And simulate the failures of monitor_test programs.
        bash$ tail -f monitor_test.log
        bash$ ps -ef | grep monitor_test
See the PID of monitor_test and kill it..
        bash$ kill -9 < PID of monitor_test >

Once you kill the process, you will notice that it immediately comes alive due to procautostart !
Next Previous Contents