python - monit doesn't start the script -


i'm trying test monit. idea have python script prints out text, have shell script acts start/stop script. shell script redirects output file called fetch_output.

what want make monit check timestamp of file , if didn't change in last minute restart script.

here python script:

test.py

 import time  import sys   in range(100):      time.sleep(1)      sys.stdout.write('a'*i)      sys.stdout.flush() 

wrapper_test

 #! /bin/bash   pidfile=/home/jhon/workspace/producer/wrapper_test.pid   case $1 in    start)      echo $$ > ${pidfile};      exec /usr/bin/python /home/jhon/workspace/producer/test.py >> fetch_output.txt 2>&1      ;;    stop)      kill `cat ${pidfile}`      ;;    *)      echo "usage: wrapper {start|stop}"       ;;   esac  exit 0 

/etc/monit/conf.d/test

 check process wrapper_test pidfile /home/jhon/workspace/producer/wrapper_test.pid    start program = "/home/jhon/workspace/producer/wrapper_test start"    stop program = "/home/jhon/workspace/producer/wrapper_test stop"    depends on fetch_output   check file fetch_output path /home/jhon/workspace/producer    if timestamp > 1 minutes        exec "/usr/bin/monit restart wrapper_test" 

the problem script not writes output file. can

ps aux | grep test root     18333  0.0  0.0  31108  4612 ?        s    14:39   0:00 /usr/bin/python /home/jhon/workspace/producer/test.py 

so can see it's working, thing confuses me when monit status fetch_output status parameter invalid type, don't know mean, wrong.

process 'wrapper_test'   status                            initializing   monitoring status                 initializing   data collected                    fri, 23 aug 2013 14:32:17  file 'fetch_output'   status                            invalid type   monitoring status                 monitored   permission                        0   uid                               0   gid                               0   timestamp                         wed, 31 dec 1969 19:00:00   size                              0 b   data collected                    fri, 23 aug 2013 14:42:14 


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -