Executing dsjob command from routine activity
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 258
- Joined: Tue Jul 04, 2006 10:35 pm
- Location: Toronto
Hi,
with the exec command activity the job runs fine.
but there is one issue.
now in the first run the execcmd runs fine, but the jobactivity1 fails.
then when we restart the job from director. it shoud start from jobactivity1.
but actually when we restarted the sequence it is starting from execcmd, this is wrong.this is happening because the return from execcmd is 1 and not 0. the sequence is assuming that it failed at execcmd and starts running from execcmd.
is there any way we can handle the returns 1( for sucess) and 2 ( for warnings) after the dsjob command in execcmd.
can i use an if then else statement in the same execcmd after the dsjob command.
with the exec command activity the job runs fine.
but there is one issue.
Code: Select all
execcmd---------jobactivity1-------------jobactivity2
then when we restart the job from director. it shoud start from jobactivity1.
but actually when we restarted the sequence it is starting from execcmd, this is wrong.this is happening because the return from execcmd is 1 and not 0. the sequence is assuming that it failed at execcmd and starts running from execcmd.
is there any way we can handle the returns 1( for sucess) and 2 ( for warnings) after the dsjob command in execcmd.
can i use an if then else statement in the same execcmd after the dsjob command.
-
- Premium Member
- Posts: 258
- Joined: Tue Jul 04, 2006 10:35 pm
- Location: Toronto
-
- Premium Member
- Posts: 258
- Joined: Tue Jul 04, 2006 10:35 pm
- Location: Toronto
This one is the one that takes non-zero output from stages that return a value to mean 'failed' and why it runs again on a checkpoint restart. Try putting a Sequencer set to 'Any' between the Execute Command stage and the next one with two links between them. Set one trigger to 'OK - Conditional' and the other to 'Otherwise' and see if that solves your problem.samyamkrishna wrote:automatically handle activities that fail
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 258
- Joined: Tue Jul 04, 2006 10:35 pm
- Location: Toronto
Hi Craig,
I tried what you said.
unchecked "automatically handle activities that fail "
Then did a fresh run. Execute command worked fine the next activity failed.
Restarted the sequence It did not skip the Execute Command but it ran the dsjob command in the execute command activity.
Or i am missing some thing in what you have said.
Then
In the execute command activity i put the above code with the dsjob command. This seems to resolve the issue.
dsjob -run -wait proj job ];if [ $? -eq "1" -o $? -eq "2" ]; then return=0; else return=1; fi; exit $return
Now it runs fine. but is this a right approach?
I tried what you said.
unchecked "automatically handle activities that fail "
Then did a fresh run. Execute command worked fine the next activity failed.
Restarted the sequence It did not skip the Execute Command but it ran the dsjob command in the execute command activity.
Or i am missing some thing in what you have said.
Then
Code: Select all
;if [ $? -eq "1" -o $? -eq "2" ]; then return=0; else return=1; fi; exit $return
In the execute command activity i put the above code with the dsjob command. This seems to resolve the issue.
dsjob -run -wait proj job ];if [ $? -eq "1" -o $? -eq "2" ]; then return=0; else return=1; fi; exit $return
Now it runs fine. but is this a right approach?
Well... I never said to uncheck anything. I said to modify your sequence in a specific way which it sounds like you did not do.
Also, dsjob with -wait will not return a 1 or a 2, it will return a zero or a non-zero (as in negative) status with the latter being a failure of some kind. You must be using -jobstatus instead as it returns the 'normal' status codes of 1,2,3 etc.
Also, dsjob with -wait will not return a 1 or a 2, it will return a zero or a non-zero (as in negative) status with the latter being a failure of some kind. You must be using -jobstatus instead as it returns the 'normal' status codes of 1,2,3 etc.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 258
- Joined: Tue Jul 04, 2006 10:35 pm
- Location: Toronto
Hi,
I have modified the sequence.
a sequencer in between with any and triggers OK conditional and the other trigger otherwise.
Now I ran it with "automatically handle activities that fail " checked.
same issue.
and yes i am using jobstatus.
so changing it to -wait instead of -jobstatus will solve this too right?
Regards,
Samyam
I have modified the sequence.
a sequencer in between with any and triggers OK conditional and the other trigger otherwise.
Now I ran it with "automatically handle activities that fail " checked.
same issue.
and yes i am using jobstatus.
so changing it to -wait instead of -jobstatus will solve this too right?
Regards,
Samyam
-
- Premium Member
- Posts: 258
- Joined: Tue Jul 04, 2006 10:35 pm
- Location: Toronto
I have used ExecSh for executing a shell script and not for directly specifying commands.
For execSh , i ll pass the shell script name and the input arguments.
In order to directly execute commands, i prefer ExecuteCommand stage.
I dont think we can execute the commands directly using ExecSh in routine activity stage,
Please correct me if my understanding is incorrect.
Thanks
For execSh , i ll pass the shell script name and the input arguments.
In order to directly execute commands, i prefer ExecuteCommand stage.
I dont think we can execute the commands directly using ExecSh in routine activity stage,
Please correct me if my understanding is incorrect.
Thanks
pandeeswaran
Your understanding is incorrect. You can use ExecSH to run anything valid to be executed from the shell, hence the name. It really doesn't know or care if that is a script or a string of native operating system functions. Use the O/S functions if that's all you need, cobble together a script if you need more control over them.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers