我是 bash 脚本新手,我正在使用下面的脚本来自动提交作业。该脚本等待上一个作业完成并自动提交新作业。
while true
do
jobstat=$(squeue -u $USER | grep DNAJB6 | wc -l)
if [[ "$jobstat" == '0' ]]; then
sbatch per3_restart.sh
break
fi
done
./script.sh &
我在我的登录节点上运行它
top | grep bash
这是我执行一段时间(也许一天)后的输出,之后即使我grep
使用进程 ID,我也不会看到这个
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26054 vadupa 20 0 140428 3052 836 S 0.3 0.0 0:04.47 bash
但一段时间后,该进程会自动终止,没有任何错误消息或警告。
我错过了什么吗?让我知道,谢谢。
编辑:
我经常注销并登录以检查进度。
输出为bash -x script.sh > /tmp/trace.txt 2>&1 &
+ [[ hxB =~ i ]]
+ export -f module
+ ENV=/hpc/eb/modules-tcl-1.923/init/profile.sh
+ export ENV
+ BASH_ENV=/hpc/eb/modules-tcl-1.923/init/bash
+ export BASH_ENV
+ '[' 4 -ge 3 ']'
+ [[ hxB =~ i ]]
+ MODULESHOME=/hpc/eb/modules-tcl-1.923
+ export MODULESHOME
+ [[ ! :/hpc/sw/hpc/bin:/hpc/sw/hpc/sbin:/usr/lib64/qt-3.3/bin:/hpc/eb/compilerwrappers/compilers:/hpc/eb/compilerwrappers/linkers:/hpc/eb/modules-tcl-1.923/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin:/home/vadupa/bin: =~ :/hpc/eb/modules-tcl-1\.923/bin: ]]
++ manpath
+ manpath=/hpc/sw/hpc/man:/hpc/sw/hpc/man:/hpc/eb/modules-tcl-1.923/share/man:/usr/local/share/man:/usr/share/man/overrides:/usr/share/man:/opt/ibutils/share/man:/hpc/sw/hpc/man:/hpc/eb/modules-tcl-1.923/share/man:/usr/local/share/man:/usr/share/man/overrides:/usr/share/man:/opt/ibutils/share/man:/usr/share/man
+ [[ ! :/hpc/sw/hpc/man:/hpc/sw/hpc/man:/hpc/eb/modules-tcl-1.923/share/man:/usr/local/share/man:/usr/share/man/overrides:/usr/share/man:/opt/ibutils/share/man:/hpc/sw/hpc/man:/hpc/eb/modules-tcl-1.923/share/man:/usr/local/share/man:/usr/share/man/overrides:/usr/share/man:/opt/ibutils/share/man:/usr/share/man: =~ :/hpc/eb/modules-tcl-1\.923/share/man: ]]
+ '[' /sw/noarch/modulefiles/environment:/hpc/sw/modules/modulefiles/init:/hpc/sw/modules/modulefiles/init-devel = '' ']'
+ '[' compilerwrappers:surfsara = '' ']'
+ '[' -r /hpc/eb/modules-tcl-1.923/init/modulerc -a /sw/noarch/modulefiles/environment:/hpc/sw/modules/modulefiles/init:/hpc/sw/modules/modulefiles/init-devel = '' -a compilerwrappers:surfsara = '' ']'
+ true
++ squeue -u vadupa
++ wc -l
+ jobstat=2
+ [[ 2 == \1 ]]