`

别忘了在disown之前执行bg命令,否则进程会一直stopped

阅读更多

别忘了在disown之前执行bg命令,否则进程会一直stopped

今天在Linux下测试程序,是直接执行的命令,如下所示:

[root@NODE22 bin]# ./cap
#======= CAP v20120216f =======#
prog-path: /root/work22/ct08/bin/
prog-name: cap
cfg_name='../cfg/cap.cfg'
loadconfig ok
checkconfig ok
System::Init ok
cap start ok, pid 8342

想到这个程序要在我下班之后继续执行,于是我就按下了Ctrl+Z

 


[1]+  Stopped                 ./cap

 

因为我准备关闭SecureCRT准备收工了,所以决定让它脱离我这个终端,执行了disown来做这件事

[root@NODE22 bin]# disown %1
-bash: warning: deleting stopped job 1 with process group 8342
[root@NODE22 bin]#

 

看看这个操作灵不灵,我看了一下日志,发现日志没有继续往下记录,正常情况应该往下记录的。

 

想起来,没有在disown之前执行bg命令,程序已经处于Stopped状态(看disown命令的输出),得让它继续往下执行

 

[root@NODE22 bin]# killall -CONT cap

 

日志也正常了。切记啊,切记啊:别忘了在disown之前执行bg命令

 

 

本文地址: http://codingstandards.iteye.com/blog/1408321

 

 

相关帮助信息:

[root@NODE22 eap_designer]# help disown
disown: disown [-h] [-ar] [jobspec ...]
    By default, removes each JOBSPEC argument from the table of active jobs.
    If the -h option is given, the job is not removed from the table, but is
    marked so that SIGHUP is not sent to the job if the shell receives a
    SIGHUP.  The -a option, when JOBSPEC is not supplied, means to remove all
    jobs from the job table; the -r option means to remove only running jobs.
[root@NODE22 eap_designer]# help bg
bg: bg [job_spec ...]
    Place each JOB_SPEC in the background, as if it had been started with
    `&'.  If JOB_SPEC is not present, the shell's notion of the current
    job is used.
[root@NODE22 eap_designer]# help fg
fg: fg [job_spec]
    Place JOB_SPEC in the foreground, and make it the current job.  If
    JOB_SPEC is not present, the shell's notion of the current job is
    used.
[root@NODE22 eap_designer]# help jobs
jobs: jobs [-lnprs] [jobspec ...] or jobs -x command [args]
    Lists the active jobs.  The -l option lists process id's in addition
    to the normal information; the -p option lists process id's only.
    If -n is given, only processes that have changed status since the last
    notification are printed.  JOBSPEC restricts output to that job.  The
    -r and -s options restrict output to running and stopped jobs only,
    respectively.  Without options, the status of all active jobs is
    printed.  If -x is given, COMMAND is run after all job specifications
    that appear in ARGS have been replaced with the process ID of that job's
    process group leader.
[root@NODE22 eap_designer]#

 

 

 

1
0
分享到:
评论
1 楼 superlittlefish 2012-02-16  
好久没有看到更新了.  要是我就选择在screen 中操作.
用简单的方式解决问题.

相关推荐

    kernelversion命令 打印内核主版本号

    xauth命令 – 修改x服务器访问授权unalias命令 – 取消命令别名logsave命令 – 将输出信息保存到指定的日志文件中hostname命令 – 显示和设置系统的主机名reset命令 – 设定终端机的状态disown命令 –

    chatty:一个使用Markov链获得幽默结果的Telegram聊天机器人

    在运行之前,必须通过设置以下环境变量来配置健谈。 CHATTY_BOT_TOKEN 您的电报漫游器令牌在此处。 通过电报从BotFather获取。 CHATTY_CHAT_ID 将此设置为您的聊天ID,以便闲聊者知道与哪个群组聊天! 我这样做是...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 登陆服务器时输入 公帐号 openlab-open123 telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss 老师测评网址 http://172.16.0.198:8080/poll/ 各个 ...

    node-http-tunnel:用于绕过限制性防火墙的 HTTP 隧道

    # On server outside the firewall ./server & disown exit On your machine inside the firewall ./client # This sets up a SOCKS5 server on your local machine Use with SSH ssh -o ProxyCommand "./ssh-...

    chia-plotting-automation

    disown 您可以使用tail -f nohup.out跟踪进度,并通过运行kill -9 PID tail -f nohup.out进程,其中可以使用ps aux | grep everplot PID找到ps aux | grep everplot ps aux | grep everplot 该脚本将: 绘制剧情将...

    KernBypass-Public:基于chroot的内核级越狱检测绕过

    跑步disown %1 完毕。 changerootfs现在是守护程序。 选择要绕过的应用 安装changerootfs之后,打开“首选项”>“ KernBypass”,然后选择要启用旁路的应用程序。 卸载 只需从Cydia卸载即可。 重启!!!

    clock:罗盘时钟

    clock (下面使用的是自己编译的nginx,并不是apt安装的nginx) nginx设置 /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf /usr/local/nginx/sbin/nginx -s ...disown -h %1 然后就可以关掉远程终端了

Global site tag (gtag.js) - Google Analytics