zoukankan      html  css  js  c++  java
  • Linux nohup命令应用简介--让Linux的进程不受终端影响

    nohup命令应用简介--Linux的进程不受终端影响

    by:授客 QQ1033553122

     

    #开启ping进程

    [root@localhost ~]# ping localhost &

    [2] 4169

    [1]   Terminated              nohup ping localhost

    [root@localhost ~]# PING localhost (127.0.0.1) 56(84) bytes of data.

    64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.105 ms

    64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.069 ms

    ...

    如图

    Linux <wbr>nohup命令应用简介--让Linux的进程不受终端影响

     

     

    #查看后台进程:

    [root@localhost ~]# ps -axu | grep ping

    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

    root      4169  0.0  0.0   4392   792 pts/0    S    04:08   0:00 ping localhost

    root      4177  0.0  0.0   4336   728 pts/1    S+   04:10   0:00 grep ping

    Linux <wbr>nohup命令应用简介--让Linux的进程不受终端影响

     

     

    #关闭开启ping命令的终端,再次查看进程

    [root@localhost ~]# ps -axu | grep ping

    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

    root      4184  0.0  0.0   4336   728 pts/1    S+   04:13   0:00 grep ping

     

    说明:进程结束

     

    #加上nohup命令,让进程不受终端影响

    [root@localhost ~]# nohup ping localhost &

    [1] 4218

    [root@localhost ~]# nohup: ignoring input and appending output to `nohup.out'

    Linux <wbr>nohup命令应用简介--让Linux的进程不受终端影响

     

    #查看后台进程

    [root@localhost ~]# ps -axu | grep ping

    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

    root      4218  0.1  0.0   4392   792 pts/0    S    04:19   0:00 ping localhost

    root      4224  0.0  0.0   4336   732 pts/1    S+   04:20   0:00 grep ping

    Linux <wbr>nohup命令应用简介--让Linux的进程不受终端影响

     

     

    #关闭开启ping命令的中断,再次查看进程

    [root@localhost ~]# ps -axu | grep ping

    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

    root      4218  0.0  0.0   4392   792 ?        S    04:19   0:00 ping localhost

    root      4229  0.0  0.0   4336   728 pts/1    S+   04:21   0:00 grep ping

     

    说明:进程依然还在

     

  • 相关阅读:
    Nginx配置文件nginx.conf中文详解
    Linux安装nginx
    熊猫TV游戏直播教程-OBS篇
    Mac下MySQL卸载方法
    sphinx 1.10-实时索引 api
    freebsd 国内相当快的ports源地址
    Springboot框架中如何读取位于resource资源中的properties配置文件,并将配置文件中的键对应的值赋值到目标bean中?
    分析Jedis源码实现操作非关系型数据库Redis
    分析线程池源码测试线程池
    socket简单示例实现从服务器拷贝文件到客户端
  • 原文地址:https://www.cnblogs.com/shouke/p/10158099.html
Copyright © 2011-2022 走看看