Passing job step execution log id to another job

688 views
Skip to first unread message

robert...@gmail.com

unread,
Nov 8, 2013, 2:15:55 PM11/8/13
to rundeck...@googlegroups.com
Hi,
 
is it possible to pass the execution output log id of a job step as a variable to another job step? I have certain commands that call a script, and while the commands execute successfully from a Rundeck perspective, the script that is called in turn may fail. I would like to parse the output of the script in order to determine it's true status, and conditionally run the next job step based on that condition.
 
The script output is captured in the step execution log (e.g. 225.rdlog in /var/lib/rundeck/logs/rundeck...). Is there a way to feed that logfile to the next job step? Piping the script output to an arbitrary file doesn't seem to work due to the nature of the command.
 
Any input is much appreciated.
 
Thanks,
Robert.

Konstantinos Christidis

unread,
Nov 9, 2013, 2:48:34 PM11/9/13
to rundeck...@googlegroups.com
Hi 
I'm not exactly sure what you want but to I often use something like this to get current execution id and logfile..

#find last current job id and logfile 
ID=`find /var/lib/rundeck/logs/rundeck/*/job/"${job.group}"/"${job.name}"/logs -name '*.rdlog' -type f -printf "%f\n" | grep rdlog | cut -f1 -d'.' | sort -n | tail -1`
FILE=`find /var/lib/rundeck/logs/rundeck/*/job/"${job.group}"/"${job.name}"/logs -name $ID.rdlog -type f | sed -e 's/ /\\ /g'`

then you can run the next job step

grep YOUR_CONDITION $FILE && conditionally-run-here..

Hope that helps,
K.

Greg Schueler

unread,
Nov 11, 2013, 11:22:05 AM11/11/13
to robert...@gmail.com, rundeck...@googlegroups.com
the current execution ID is availabe in the "job.execid" context variable. 

However I would recommend you capture the output of the script you want to parse in some other fashion, rather than grep'ing a rundeck rdlog file.  
--
Greg Schueler
--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages