Not sure why but the following (large code block) hangs on the final at command. Most of the processing is irrelevant to the problem and I've tried to remove as much as possible to improve legibility.
Code as follows:
#!/bin/ksh
date="Mon"
time="13"
prod=/apps/prod
SrcFiles=/apps/informat5/informatica/PowerCenter/SrcFiles
#Function to write to current_schedule.txt
function atlist_f {
atlist1="echo \"Job_Id: EMS Light Date: \`date\`\" >> $SrcFiles/current_schedule.txt"
atlist2="echo \`at -l\` >> $SrcFiles/current_schedule.txt"
eval $atlist1
eval $atlist2
rm -f $marker
}
if [ $date = "Fri" ]
then
#declare directory variables
prod=/apps/prod
test=/apps/dev
SrcFilestestinf=/apps/informatica/powercenter/SrcFiles
buzzsaw=buzzsaw.cisco.com:/fs/ftp/home/mbis/pub/techmar
buzzsawselfserve=buzzsaw.cisco.com:/fs/ftp/home/mbis/pub/selfserve
scripts=/apps/prod/ems/scripts
namelist=$scripts/names_k2k.txt
marker=$scripts/temp/k2k_test_marker_file
filename=$scripts/self_serve_echo
counter=$scripts/temp/ems_light_counter
#Create a file containing possible files not wanting to be overwritten
ls $SrcFiles/SELF_SERVE*.txt > $marker
today=`date '+20%y%m%d'`
if [ -s $marker ]
then
if [ $time -ge 9 -a $time -le 17 ]
then
echo "Schedule for 1 hours time. Between 9 and 1700 hours"
atlist_f
elif [ $time = 18 ]
then
echo "Email: second to last attempt. Friday. 1 more try then next friday"
atlist_f
elif [ $time -ge 19 ]
then
echo "Re-schedule for Monday due to files in the SrcFiles directory being present"
atlist_f
fi
else
cd $SrcFilesprodinf
echo "Copy would be made at this point. No files in target directory. file in Source directory"
if [ "$?" = "1" ]
then
echo "Copy failed for some reason. Details written to log. Retry in 1 hour"
atlist_f
else
echo "Success ful copy made"
at 09:00 friday < $filename > /dev/null 2>&1
atlist_f
fi
fi
else #####PROBLEM WITH HANGING############
echo "Day not friday, schedule for friday"
at 09:00 friday < $filename > /dev/null 2>&1
atlist_f
fi
------------
I have seen this happen before and can't see why the final at command does not run like all the others do.
If you wizkids can see the problem, I would love some advice on it.
cheers
simmo
Code as follows:
#!/bin/ksh
date="Mon"
time="13"
prod=/apps/prod
SrcFiles=/apps/informat5/informatica/PowerCenter/SrcFiles
#Function to write to current_schedule.txt
function atlist_f {
atlist1="echo \"Job_Id: EMS Light Date: \`date\`\" >> $SrcFiles/current_schedule.txt"
atlist2="echo \`at -l\` >> $SrcFiles/current_schedule.txt"
eval $atlist1
eval $atlist2
rm -f $marker
}
if [ $date = "Fri" ]
then
#declare directory variables
prod=/apps/prod
test=/apps/dev
SrcFilestestinf=/apps/informatica/powercenter/SrcFiles
buzzsaw=buzzsaw.cisco.com:/fs/ftp/home/mbis/pub/techmar
buzzsawselfserve=buzzsaw.cisco.com:/fs/ftp/home/mbis/pub/selfserve
scripts=/apps/prod/ems/scripts
namelist=$scripts/names_k2k.txt
marker=$scripts/temp/k2k_test_marker_file
filename=$scripts/self_serve_echo
counter=$scripts/temp/ems_light_counter
#Create a file containing possible files not wanting to be overwritten
ls $SrcFiles/SELF_SERVE*.txt > $marker
today=`date '+20%y%m%d'`
if [ -s $marker ]
then
if [ $time -ge 9 -a $time -le 17 ]
then
echo "Schedule for 1 hours time. Between 9 and 1700 hours"
atlist_f
elif [ $time = 18 ]
then
echo "Email: second to last attempt. Friday. 1 more try then next friday"
atlist_f
elif [ $time -ge 19 ]
then
echo "Re-schedule for Monday due to files in the SrcFiles directory being present"
atlist_f
fi
else
cd $SrcFilesprodinf
echo "Copy would be made at this point. No files in target directory. file in Source directory"
if [ "$?" = "1" ]
then
echo "Copy failed for some reason. Details written to log. Retry in 1 hour"
atlist_f
else
echo "Success ful copy made"
at 09:00 friday < $filename > /dev/null 2>&1
atlist_f
fi
fi
else #####PROBLEM WITH HANGING############
echo "Day not friday, schedule for friday"
at 09:00 friday < $filename > /dev/null 2>&1
atlist_f
fi
------------
I have seen this happen before and can't see why the final at command does not run like all the others do.
If you wizkids can see the problem, I would love some advice on it.
cheers
simmo