https://hostloc.com/thread-1154840-1-3.html
https://serverfault.com/questions/10811/how-to-add-a-script-to-startup-and-shutdown-in-debian
https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6
按照些教程准备在armbian安装,前面都很好,就是创建 /etc/init.d/cloudflared启动脚本时,Armbian不工作, 无法启动。
然后就查到了 init已经被systemd替换了,所以就使用systemd来启动cloudflared.
https://serverfault.com/a/946483
创建cloudflared.service
文件
vim /lib/systemd/system/cloudflared.service
内容如下:
[Unit]
Description=cloudflared tunnels service
After=network.target
StartLimitBurst=5
StartLimitIntervalSec=10
[Service]
Type=simple
Restart=always
RestartSec=2
User=root
ExecStart=/usr/bin/cloudflared --no-autoupdate tunnel run --token yourtoken
[Install]
WantedBy=multi-user.target
Enable
systemctl enable cloudflared
Created symlink /etc/systemd/system/multi-user.target.wants/cloudflared.service → /lib/systemd/system/cloudflared.service.
启动
systemctl start cloudflared
查看状态
root@aml:~# systemctl status cloudflared
● cloudflared.service - cloudflared tunnels service
Loaded: loaded (/lib/systemd/system/cloudflared.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-04-07 18:11:11 CST; 5s ago
Main PID: 224396 (cloudflared)
Tasks: 9 (limit: 1078)
Memory: 24.8M
CGroup: /system.slice/cloudflared.service
└─224396 /usr/bin/cloudflared --no-autoupdate tunnel run --token yourtoken
还没有人评论,抢个沙发吧...