找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 1418|回复: 7

请问怎么写一个进程守护

[复制链接]
发表于 2022-4-6 15:01 | 显示全部楼层 |阅读模式
我需要写一个守护syncthing syncthing/syncthing: Open Source Continuous File Synchronization (github.com) 如果掉线或崩溃需要重新启动它

我的恩山、我的无线 The best wifi forum is right here.
 楼主| 发表于 2022-4-6 15:02 | 显示全部楼层
请高手赐教
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-6 15:28 | 显示全部楼层
本帖最后由 99010 于 2022-4-6 15:31 编辑

。。。。。。。。。。。。。。。。。。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-6 15:30 | 显示全部楼层
本帖最后由 wulishui 于 2022-4-6 15:33 编辑

感觉你逗我们玩。直接百度你的标题就是教程。

点评

小白看不懂 没有例子  详情 回复 发表于 2022-4-6 22:29
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-6 17:29 | 显示全部楼层
楼上是个好人啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-4-6 22:29 | 显示全部楼层
wulishui 发表于 2022-4-6 15:30
感觉你逗我们玩。直接百度你的标题就是教程。

小白看不懂 没有例子

点评

#!/bin/sh /etc/rc.common # Copyright (C) 2006-2011 OpenWrt.org START=99 USE_PROCD=1 PROG=/etc/syncthing start_service() { procd_open_instance procd_set_param command "$PROG" procd_se  详情 回复 发表于 2022-4-6 23:09
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-4-6 23:09 | 显示全部楼层
fenleba 发表于 2022-4-6 22:29
小白看不懂 没有例子

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org

START=99

USE_PROCD=1
PROG=/etc/syncthing

start_service() {
        procd_open_instance
        procd_set_param command "$PROG"
        procd_set_param respawn 0
        procd_close_instance
}

stop_service(){
        service_stop "$PROG"
}

百度就有例子,上面的脚本保存为syncthing放在/etc/init.d/,试过能用,红字改为实际路径
开机自动启动ln -s /etc/init.d/syncthing /etc/rc.d/S999syncthing

点评

太感谢了 ~~!  详情 回复 发表于 2022-4-8 17:59

评分

参与人数 1恩山币 +2 收起 理由
fenleba + 2 2333

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-4-8 17:59 | 显示全部楼层
fk20100010 发表于 2022-4-6 23:09
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org

太感谢了  ~~!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-16 19:42

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表