我有一个名为new_script的 csh 脚本(我必须使用 csh,我不能使用 bash),它调用另一个名为 soak_script 的脚本12次。浸泡脚本会休眠12 小时,然后进行一些测试。
我的问题是我的原始脚本(new_script)在浸泡脚本执行一次后自动终止。如果我将睡眠时间从 12 小时减少到 30 秒,则整个脚本工作正常,并且soak_script应执行 12 次。为什么会这样?请帮我。我是 linux 和脚本的初学者,我真的迷路了。
#!/bin/csh -f
clear
echo "*****************************SIMULATION STARTED***********************************"
echo ""
echo "Sim Start Time : `date`"
echo "Sim Folder : ${cwd}"
echo ""
ls | grep -E 'soak|scan' > ls_all
echo "List of all simulation sub-folders:"
cat ls_all
echo ""
foreach line ( "`cat ls_all`" )
if ($line =~ *scan*) then
cd ..
echo "CURRENT DIRECTORY: ${PWD}"
echo "Copying char_nosleep.c to char.c"
cp char_nosleep.c char.c
if ($? != 0) then
echo "Copying failed"; exit 2
endif
cd /u/rahul7/p4/prod/virgo2/diags/src
echo "CURRENT DIRECTORY: ${PWD}"
echo "Making char_nosleep.c for $line"
make
if ($? != 0) then
echo "Making failed"; exit 3
endif
wait
echo "****************************************************************************************************************************************************************************"
cd bin/vdma/TestSet2_100_100
cd $line
echo "CURRENT DIRECTORY: ${PWD}"
echo "RUNING.."
echo "Run Start Time : `date`"
ls | grep ^data > ls_run
foreach command ( "`cat ls_run`" )
if ($command =~ *Micron*) then
./$command > mcrn_run_out &
else if ($command =~ *Samsung*) then
./$command > ssung_run_out &
else if ($command =~ *Toshiba*) then
./$command > tshba_run_out &
else
echo "Micron, Toshiba or Samsung run file not found in $(pwd)!"; exit 4;
endif
end
wait
rm -f ls_run
echo "Run End Time : `date`"
echo "****************************************************************************************************************************************************************************"
cd ..
else if ($line =~ *soak*) then
cd ..
echo "CURRENT DIRECTORY: ${PWD}"
echo "Copying char_sleep_12hr.c to char.c"
cp char_sleep_12hr.c char.c
if ($? != 0) then
echo "Copying failed"; exit 2
endif
cd /u/rahul7/p4/prod/virgo2/diags/src
echo "CURRENT DIRECTORY: ${PWD}"
echo "Making char_sleep_12hr.c for $line"
make
if ($? != 0) then
echo "Making failed"; exit 3
endif
wait
echo "****************************************************************************************************************************************************************************"
cd bin/vdma/TestSet2_100_100
cd $line
echo "CURRENT DIRECTORY: ${PWD}"
echo "RUNING.."
echo "Run Start Time : `date`"
ls | grep ^data > ls_run
foreach command ( "`cat ls_run`" )
if ($command =~ *Micron*) then
./$command > mcrn_run_out &
else if ($command =~ *Samsung*) then
./$command > ssung_run_out &
else if ($command =~ *Toshiba*) then
./$command > tshba_run_out &
else
echo "Micron, Toshiba or Samsung run file not found in $(pwd)!"; exit 4;
endif
end
wait
rm -f ls_run
echo "Run End Time : `date`"
echo "****************************************************************************************************************************************************************************"
cd ..
endif
end
rm -f ls_all
echo "Sim End Time : `date`"