REAPI/check.py
mzeros e5ab00f136 feat(merchant): 添加回调失败自定义规则切换渠道功能
- 在商户表单中添加回调失败自定义规则切换渠道选项
- 实现订单回调失败时根据自定义规则切换到其他渠道的功能
- 优化订单状态监控和预警逻辑
- 修复部分渠道充值接口问题
2025-01-20 12:17:16 +08:00

28 lines
756 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import subprocess
timeSleep = 15
def run_command(command, bg=False):
if bg:
command += ' &'
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
return result.stdout.strip()
def is_process_running(process_name):
try:
output = subprocess.run(['pgrep', '-f', process_name], stdout=subprocess.PIPE, text=True)
return len(output.stdout.strip()) > 0
except Exception:
return False
def start_daemon():
command = 'python /www/sites/reapi/index/daemon.py 1>/dev/null 2>&1 &'
if not is_process_running('daemon.py'):
run_command(command)
if __name__ == "__main__":
start_daemon()