#!/bin/python
import os
import time
import commands
##开启frp
def start():
os.system('/home/pi/frp/frpc -c /home/pi/frp/frpc.ini > /dev/null 2>&1 &')
##检查是否运行frp
def state():
out=commands.getoutput('ps aux|grep frpc|grep -v grep')
return out
def main():
while(True):
if "-c" in state() :
pass
else:
start()
time.sleep(15) ##休眠15秒后再次检查
if __name__ == '__main__':
time.sleep(15) ##开机后延时15秒
main()
Last modification:October 23, 2019
© Allow specification reprint