#!/usr/bin/python from ido import check_monitor a=check_monitor() print a[0] print 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' print a[1]
__author__ = 'idlevy' import os import subprocess import shutil import time import sys from ido import check_monitor startm=u'su - smsc -c startm' file1='/home/smsc/site/trace/MRE/start_MRE.1.1.log' FNULL='/dev/null' a=check_monitor('monitor') print a pname = a[1] if a[0] == 1: print pname +" is down" else: #to remove after testing. tmpProc=subprocess.call('su - smsc -c stopm',shell=True) print 'stoping monitor process' time.sleep(15) print "reset log file and starting monitor process" shutil.copy(FNULL,file1) proc=subprocess.Popen(startm,shell=True,stdout=subprocess.PIPE)