1. 连接云端服务器
ssh ubuntu@server_ip
本项目ucloud server ip:106.75.91.131
2. ubuntu在后台运行程序
1)screen
- 新建一个screen: screen -S my_screen_name
- 暂时断开screen: Ctrl+a d
- 重新打开screen: Ctrl+a screen_id
- 查看所有screen状态: screen -ls
- 终止screen: screen -S my_screen_name -Xkill
- 在当前窗口新建窗口: Ctrl+a c
- 退出当前窗口: exit显示所有窗口列表:Ctrl+a w
2) nohup
- 将程序运行输出记录在当前目录下的nohup.out文件下
nohup your_command & #(符号&使程序在后台运行)
exit #(退出nohup模式)
- 将日志输出在my_nohup.log文件中,并将stderr重定向至stdout
nohup your_command > my_nohup.log 2>&1 &
- 退出nohup模式之后,停止程序
ps -ef|grep "your_command" #(查找运行该命令的进程)
kill -9 your_command_pid #(根据进程号关闭程序)