如何在unix中在后台运行shell脚本 [英] how to run shell script in background in unix
本文介绍了如何在unix中在后台运行shell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在unix后台运行shell脚本?
how to run shell script in background in unix?
我的剧本
#!/bin/sh
while [ true ]
do
ps -fu $USER>>/home/axway/trace.log 2>&1
sleep 10
done
在后台通过 nohup
命令在 promt 上运行上面的脚本(shellEx1.sh
)
running above script (shellEx1.sh
) in background by nohup
command on promt
nohup ./shellEX1.sh &
有以下问题:
$ nohup ./shellEX1.sh &
[3] 19520
$ nohup: ignoring input and appending output to `nohup.out'
推荐答案
它警告说脚本的输出将写入文件nohup.out".为了消除此警告,您可以尝试
Its warning to say like the output of the script will be written in file 'nohup.out'. In order to remove this warning, you can try
nohup ./shellEX1.sh >/tmp/output.txt &
或
nohup ./shellEX1.sh >/dev/null &
这篇关于如何在unix中在后台运行shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文