ubuntu添加开机启动脚本

ubuntu添加开机启动脚本

  • 内网的某台服务器 需要做frp穿透 在重启后需要自动打开frpc
  • shell脚本示例 frpc.sh
https://mp.weixin.qq.com/s/W6ZTy47ZFuwatCpwM85uxw
#!/bin/bash
/你的frp客户端路径/frpc -c /你的frp客户端路径/frpc.ini > /dev/null
  • 加入开机启动
拷贝到/etc/init.d
	cp ./frpc.sh /etc/init.d/frpc.sh
赋予权限
	cd /etc/init.d
	chomd 777 frpc.sh
执行命令,将脚本添加到初始化执行的队列中去 
	update-rc.d frpc.sh defaults 99
	# 因为需要用到网络 放到最后执行
  • 卸载启动脚本的方法
cd /etc/init.d
update-rc.d -f frpc.sh remove

你可能感兴趣的:(软件)