如何在关闭SSH Session的情况下,程序还能继续运行
2016-03-21 12:17
302 查看
有时我们希望程序在SSH Session断开的情况下,可以继续运行。Wiki的nohup页面提供了以下几种方式:
1.nohup命令
nohup是一个POSIX命令,忽视退出终端时的HUP(hangup)信号。
示例:
执行下面的命令启动程序abcd,abcd在后台运行,且忽视接下来logout产生的HUP信号。
$ nohup abcd &
$ exit
2.disown -h
有的Shell(e.g. bash)有内置命令,可以将某一job从job table中移走,Session关闭时,这一job将不会收到SIGHUP信号。
bash示例:
$ ./abcd
$ Ctrl-Z
$ bg
$ disown -h abcd
3. Screen
http://en.wikipedia.org/w/index.php?title=Nohup&gettingStartedReturn=true
http://stackoverflow.com/questions/285015/linux-prevent-a-background-process-from-being-stopped-after-closing-ssh-client
1.nohup命令
nohup是一个POSIX命令,忽视退出终端时的HUP(hangup)信号。
示例:
执行下面的命令启动程序abcd,abcd在后台运行,且忽视接下来logout产生的HUP信号。
$ nohup abcd &
$ exit
2.disown -h
有的Shell(e.g. bash)有内置命令,可以将某一job从job table中移走,Session关闭时,这一job将不会收到SIGHUP信号。
bash示例:
$ ./abcd
$ Ctrl-Z
$ bg
$ disown -h abcd
3. Screen
http://en.wikipedia.org/w/index.php?title=Nohup&gettingStartedReturn=true
http://stackoverflow.com/questions/285015/linux-prevent-a-background-process-from-being-stopped-after-closing-ssh-client
相关文章推荐
- java static关键字用法详解
- JavaScript系列:正则表达式
- 关于对张伟祥同学的代码复审!
- PHP进阶篇:取得日期的Unix时间戳
- CENTOS 内存释放
- OpenCV HOG Detector: Result Clustering
- 阅读程序 回答问题——FindTheNumber
- ajax与HTML5 history pushState/replaceState实例
- PullToRefreshViewPager和ViewPager制作卡片效果
- myeclipse 2015 stable 2.0连接mysql URL错误
- iOS AssetsLibrary和Photos的使用总结: 原图获取(2)
- LeetCode "Counting Bits"
- 栈在java中的实现
- mysql锁-乐观锁
- Docker历险记(一)
- js 跨域访问
- PHP进阶篇:取得当前的日期
- Java并发编程(三)——synchronized
- Span 介绍及使用(二)
- python的unicode处理关系