dever 3 years ago
parent
commit
c6bd11a3b8
2 changed files with 24 additions and 1 deletions
  1. 23 0
      check.py
  2. 1 1
      master_cron.py

+ 23 - 0
check.py

@@ -0,0 +1,23 @@
+#!/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()

+ 1 - 1
master_cron.py

@@ -31,7 +31,7 @@ def popen(command, bg=False):
 
 
 # 文档转换
 # 文档转换
 def convert():
 def convert():
-        check = 'ps -ef | grep master.py | grep -v grep | wc -l'
+        check = 'ps -ef | grep master_cron.py | grep -v grep | wc -l'
         value = int(popen(check))
         value = int(popen(check))
         if value > 1:
         if value > 1:
                 return 1;
                 return 1;