(杂项)Debian9开机自动执行脚本

2020-01-31  本文已影响0人  Jesse4023

Debian 9 默认不带 /etc/rc.local 文件?而 rc.local 服务却还是自带的。

参考该篇文章链接

例如开机后台启动frp服务。

root@phicomm:~/frp_0.28.2_linux_arm64# cat startfrpc.sh
#!/bin/sh
cd /root/frp_0.28.2_linux_arm64
./frpc -c frpc.ini 1>/dev/null 2>&1 &

1>/dev/null 2>&1 &保持后台运行

对应rc.local文件

root@phicomm:~/frp_0.28.2_linux_arm64# cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/root/frp_0.28.2_linux_arm64/startfrpc.sh
exit 0

再执行:

systemctl enable rc-local
systemctl start rc-local.service
上一篇 下一篇

猜你喜欢

热点阅读