linux客户端npc内网穿透开机后台自启动
1、下载配置Linux版本npc网址:Releases · ehang-io/nps · GitHub下载最新版本:wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_client.tar.gz(可以将包放置任意位置并提取出来,其余npc配置省略、、、)2、npc自启动配置(1)建立启动脚本编写--
·
1、下载配置Linux版本npc
网址:Releases · ehang-io/nps · GitHub
下载最新版本:wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_client.tar.gz
(可以将包放置任意位置并提取出来,其余npc配置省略、、、)
2、npc自启动配置
(1)建立启动脚本编写--start.sh
#!/bin/bash
cd /home/xxx/xxx/linux_amd64_client/
echo 'pwd'|sudo -S nohup ./npc >file.out 2>&1 &
可以将start.sh与npc服务放一起
(2)配置npc.service文件
[Unit]
Description=npc
After=network.target
[Service]
Type=forking
ExecStart=/home/xxx/xxx/linux_amd64_client/start.sh
Restart=always
RestartSec=5
PrivateTmp=true
[Install]
WantedBy=multi-user.target
将npc.service放置到/lib/systemd/system中
(3)启动并测试
systemctl daemon-reload
systemctl enable npc #设置开机启动
systemctl start npc #开启服务
systemctl status npc #查看状态
最后reboot测试,查看是否开机自启。
更多推荐
已为社区贡献2条内容
所有评论(0)