#!/usr/bin/env python # -*- coding: utf-8 -*- import time import os timeSleep = 15 def popen(command, bg=False): string = command if bg == True: command = command + ' &' process = os.popen(command) output = process.read() process.close() return output def process(): command = 'python /data/dm/container/web/master_cron.py 1>/dev/null 2>&1 &' check = 'ps -ef | grep master_cron.py | grep -v grep | wc -l' value = int(popen(check)) if value == 0: popen(command) process()