turmux接入阿里云,解决阿里云手机客户端断网问题,运行完整的linux

<用户名+密码连接方式>
turmux安装openssh
启动ssh输入sshd
连接阿里云ssh 用户名(root)+@+服务器实例ip地址
turmux提示下输入yes
输入密码
回车
连接成功
turmux bashrc 添加快捷方式
function ss(){
sshd
ssh root@47.98.175.166
}
测试服务器成功运行,以下是连接地址

http://47.108.229.189:3389

nohup python3 /root/python-project/app/main.py(把此项写进bashrc,服务器就会一直运行)
或者nohup python3 /root/python-project/app/main.py &
不用容器,不集群,不负载均衡,简单测试
turmux 安装 apt install screen
screen -S ssh 在turmux上运行一个进程。
ssh root@47.98.175.166在ssh这个进程里启动连接,turmux上连接的持久化,但服务器也会主动中断连接。
服务器上运行screen -S ssh
ssh root@47.98.175.166
yes
输入密码
建立连接
用CTRL+a然后按d
此方法只要服务器不重启,此进程也会一直运行
如果服务器重启,要重复以上步骤开进程,有点麻烦
用进程守护开启服务
apt install -y systemd
vim /etc/systemd/system/test.service
写入以下内容
[Unit]
Description=My test serviceAfter=multi-user.target[Service]Type=simpleRestart=alwaysExecStart=/usr/bin/python3 /home//test.py[Install]WantedBy=multi-user.target

重新加载守护进程
sudo systemctl daemon-reload
让我们启用我们的服务,以便在服务器重新启动时它不会被禁用。
sudo systemctl enable test.service

现在让我们开始我们的服务。
sudo systemctl start test.service
检查状态
sudo systemctl status name_of_your_service
查看所有服务
service --status-all | grep +
分别在客户端ssh_config,sshd_config写入以下内容防止连接中断

ServerAliveCountMax 12000 ServerAliveInterval 30 KeepAlive yes
TCPKeepAlive yes

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值