I have a weird issue going on. We run jobs using dsjob command which runs fine in one environment but not in the other.
I use the following command.
dsjob -run -jobstatus $prm_project $prm_job
Return value I get from this command is "waiting for job..." in the environment where it fails.
My understanding is that it needs to wait for the job to complete and then return value.
I have a step in my script which checks for the return value of this command like this.
if test $Run_Stat_Val -eq 1
then
Ret_Val=0
else
exit 99
fi
This fails because it's a string value. What I don't understand is why it runs fine in one place but not in other place.
Is there any environment changes causing this and is there a way I can check it ?
Appreciate your help...
Problem with dsjob command...
Moderators: chulett, rschirm, roy
I am sorry...Let me rephrase it..Why am I getting the return value from the dsjob command as "Waiting for job..." instead of some integer when I use Jobstatus in dsjob coammand ?
I am using the same script in both environments but one environment it fails because I get value "Waiting for job..." instead of integer but in Production environment it never fails.
I am using the same script in both environments but one environment it fails because I get value "Waiting for job..." instead of integer but in Production environment it never fails.
Are you sure that is the return status? Or does it simply echo that to the screen while the job is running? I'd also be curious exactly how you are capturing the status into your $Run_Stat_Val variable - can you post that segment of the script?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig
Thanks for the reply. Below is the code snippet...
Please advise.
Thanks
Thanks for the reply. Below is the code snippet...
Code: Select all
Run_Stat=`dsjob -run -jobstatus $prmStr $prm_project $prm_job 2> /dev/null`
echo Run_Stat is $Run_Stat >> $Script_LogDir/$Script_LogFileName
Run_Stat_Null=${Run_Stat:="Y"}
echo Run_Stat_Null is $Run_Stat_Null >> $Script_LogDir/$Script_LogFileName
if [[ "$Run_Stat_Null" = "Y" ]];
then
echo Job is in Bad State >> $Script_LogDir/$Script_LogFileName
exit 99;
fi;
Run_Stat_Val=`echo $Run_Stat | head -1 | cut -d"(" -f2 | cut -d")" -f1`
echo Run_Stat_Val is $Run_Stat_Val >> $Script_LogDir/$Script_LogFileName
Run_Stat_Val_Null=${Run_Stat_Val:="Y"}
echo Run_Stat_Val_Null is $Run_Stat_Val_Null >> $Script_LogDir/$Script_LogFileName
if [[ "$Run_Stat_Val_Null" = "Y" ]];
then
echo Job is in Bad State >> $Script_LogDir/$Script_LogFileName
exit 99;
fi
Thanks