博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
别忘了在disown之前执行bg命令,否则进程会一直stopped
阅读量:2442 次
发布时间:2019-05-10

本文共 2250 字,大约阅读时间需要 7 分钟。

别忘了在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]#

 

 

 

转载地址:http://plnqb.baihongyu.com/

你可能感兴趣的文章
GNOME帮助Linux应用于商业桌面环境(转)
查看>>
linux网络知识:与网络设置有关的几个文件(转)
查看>>
Linux文件内容查询命令(转)
查看>>
libc.a 文件恢复(转)
查看>>
SCO UNIX上cpio命令详细用法(转)
查看>>
Linux系统可卸载内核模块完全指南(下)(转)
查看>>
思考-两个大表的关联.txt
查看>>
WIDTH_BUCKET和NTILE函数.txt
查看>>
sql plan baseline(二)
查看>>
第十章 sqlplus的安全性
查看>>
第十三章 sqlplus命令(一)
查看>>
第三章(backup and recovery 笔记)
查看>>
第一章(backup and recovery 笔记)
查看>>
第六章(backup and recovery 笔记)
查看>>
oracle备份功能简述
查看>>
[转]数据库三大范式
查看>>
恢复编录的创建和使用.txt
查看>>
truncate 命令使用
查看>>
[script]P_CHECK_BLACK.sql 检查当前用户下是否有varchar2字段的末尾包含空格
查看>>
实验-数据分布对执行计划的影响.txt
查看>>