弄了个frp做内网穿透,需要开机自启
写了个systemd服务之后,一开始写成:
[Unit]
Description=frp123
Wants=ssh
After=ssh
[Service]
ExecStart=/home/neo/frp123.sh
[Install]
WantedBy=multi-user.target
发现无法达到要求,用systemctrl status查看服务状态,会提示服务启动失败,网络未上线
于是,按照网上说的,改成这样:
[Unit]
Description=frp123
Wants=-networkd--online.target
After=networkd--online.target
[Service]
ExecStart=/home/neo/frp123.sh
[Install]
WantedBy=multi-user.target
还是不行!
还是墙外吧,唉,google一下,改成:
[Unit]
Description=frp123
Wants=systemd-networkd-wait-online.service
After=systemd-networkd-wait-online.service
[Service]
ExecStart=/home/neo/frp123.sh
[Install]
WantedBy=multi-user.target
OK,成功了,系统:uos 2020-1022,