特征: 自动加载配置文件夹内除config-obfs.json的配置文件. 如需新建一个用户,直接创建一个 config_NAME.json 文件即可.(NAME自行替换)
说明:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # 查找自启动文件 AutoFile=“$(ls -1 /etc/init.d/*-libev |head -n1)”; # 检测查找结果 [ –n “$AutoFile” ] || exit 1; # 修改PID文件 sed –i ‘s|PIDFILE=.*.pid$|PIDFILEPATH=/var/run/$NAME|g’ “$AutoFile”; # 修改启动方式 sed –i ‘s|do_start$|for CONFFILE in `find /etc/$NAME -maxdepth 1 -path “/etc/$NAME/config-obfs*.json” -prune -o -name ‘config*.json‘ -print`; do PIDFILE=”$PIDFILEPATH/$(basename $CONFFILE)”; do_start; done|g’ “$AutoFile”; # 移除systemctl守护配置(必须,由于其他原因,可能会误伤.) [ –d /lib/systemd/system ] && find /lib/systemd/system –name ‘*-libev*’ –exec rm –rf {} \; # 重新加载自启动(必须) [ –d /lib/systemd/system ] && systemctl daemon–reload # 赋予执行权限(可选) chmod 755 “$AutoFile”; # 重新启动(可选) bash “$AutoFile” restart; |
---|
懒人版(只有修改功能,请自行安装主程序):
1 | wget —no–check–certificate –qO– ‘https://moeclub.org/attachment/LinuxShell/multi-for-libev.sh’ |bash |
---|
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有