123456789101112131415161718192021222324 |
- #!/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 /www/api/daemon.py 1>/dev/null 2>&1 &'
- check = 'ps -ef | grep daemon.py | grep -v grep | wc -l'
- value = int(popen(check))
- if value == 0:
- popen(command)
- process()
|