视频加载失败

frp开机启动与自动检查运行脚本(Python)

73 字
1 分钟
frp开机启动与自动检查运行脚本(Python)
frp开机启动与自动检查运行脚本(Python)
#!/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()

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或打赏支持!

打赏
frp开机启动与自动检查运行脚本(Python)
https://rehtt.com/posts/15/
作者
Rehtt
发布于
2017-12-08
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
Rehtt
Hello, I'm Rehtt.
公告
欢迎来到我的博客!
分类
标签
最新动态
站点统计
文章
150
分类
17
标签
73
总字数
67,772
运行时长
0 天
最后活动
0 天前
站点信息
构建平台
Local
博客版本
Firefly v6.16.8
文章许可
CC BY-NC-SA 4.0

当前页面没有目录

文章目录

当前页面没有目录