我正在运行以下命令:
nohup ./run_hyper_param_tuning.sh> ../../logs/hyper_model_15_b_Jan.txt 2>&1 & echo $! >save_pid.txt
它一直在工作,但现在突然停止工作了。脚本如下:
#!/bin/bash
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
#added by Anaconda3 installer
export PATH="/home/javier/anaconda3/envs/AIenv/bin:$PATH"
#export PATH="/home/javier/anaconda3/bin:$PATH"
#source /home/javier/anaconda3/bin/activate AIenv
echo "STARTING HYPER-PARAMETER TUNING..."
backbones=("resnet101")
gradient_clip_norms=(10)
learning_rates=(0.001)
weight_decays=(0.0005)
layers=('heads')
for i in "${backbones[@]}"
do
for j in "${gradient_clip_norms[@]}"
do
for k in "${learning_rates[@]}"
do
for l in "${weight_decays[@]}"
do
for m in "${layers[@]}"
do
echo "-----------------------------------------------------------------------------------"
echo "backbone:" $i " gradient_clip_norms:" $j " learning_rate:" $k " weight_decays:" $l "layers:" $m
echo "-----------------------------------------------------------------------------------"
python3 custom.py train --dataset=customImages/ --weights=coco --backbone=$i --grad_clip_norms=$j --learn_rate=$k --weight_decays=$l --layers=$m --epochs=100
echo "successfully done"
done
done
done
done
done
我重定向输出的文件具有以下消息:
[1]+ Exit 125 nohup ./run_hyper_param_tuning.sh > ../../logs/hyper_model_15_b_Jan.txt 2>&1
但是,当我再次用 cat 显示内容时,文件为空。
我该如何解决这个问题?
答案1
根据(GNU)nohup
文档,这nohup
本身就是失败的。
-bash-4.2$ man nohup | grep 125
-bash-4.2$ info nohup | grep 125
info: Writing node (coreutils.info.gz)nohup invocation...
info: Done.
125 if 'nohup' itself fails, and 'POSIXLY_CORRECT' is not set
instead of 125.
也许尝试一下strace
看看nohup
它正在故障转移?