在Linux中挂载一个持续运行的脚本
1.创建一个子会话
[root@centos ~]# screen -S session1
2.在子会话中执行后台脚本命令
[root@centos ~]# python3 csdn.py >> file 2>&1 &
[1] 2561
3.查看后台任务
[root@centos ~]# jobs
[1]+ Running python3 csdn.py >> file 2>&1 &
4.跳出该子会话
[root@centos ~]# screen -d 2561
[remote detached from 2561.session1]
[root@centos ~]#
5.在主会话(终端界面)查看会话情况
[root@centos ~]# screen -ls
There is a screen on:
2561.session1 (Detached)
1 Socket in /var/run/screen/S-root.
6.关闭会话
[root@centos ~]# screen -X -S 2561 quit