【问题标题】:KShell background task not showing in jobsKShell 后台任务未显示在作业中
【发布时间】:2010-12-11 14:57:24
【问题描述】:

我编写了一个简单的 KShell 脚本来启动后台任务

#/bin/ksh 
#startMonitoring

./detectFile /usr/local/data/testFile > fileHistory &

我使用以下命令运行它

startMonitoring

当我运行作业时,我没有得到任何结果,但命令正在运行并显示在 ps 中:

512232 pts/0 0:34 /bin/ksh ./detectFile /usr/local/data/testFile

为什么我看不到作业中的项目,如何更改我的脚本以使其显示在作业中?

【问题讨论】:

  • 是否应该将其移至 ServerFault?

标签: shell ksh background-process


【解决方案1】:

jobs 命令仅在当前 shell 中查找。脚本在它们自己的 shell 中运行。如果您改为获取脚本,jobs 将显示它:

$ . startMonitoring
$ jobs
[1] +  Running                 . startMonitoring

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 2017-06-26
    • 2023-04-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多