date/time context variable

680 views
Skip to first unread message

Eryk Dworak

unread,
Aug 1, 2016, 12:31:32 PM8/1/16
to rundeck-discuss
I've tried to approach this problem from different angles, however the result is always the same. I cannot seem to pass 'date' variable to command.
What I require is a way to add a date to filename, i.e.:

/var/log/rundeck_${node.hostname}_${job.datetime}

I assume this is possible but I cannot find any reference to date/time context variable.

Any input would be much appreciated.

Thanks,
Eryk

Alex Honor

unread,
Aug 1, 2016, 12:41:53 PM8/1/16
to rundeck...@googlegroups.com
Hi Eryk,

Add an option called "datetime" with a default value containing a string like this: ${DATE:<format-specifier>}.
The format-specifier uses Java simple date format. Eg ${DATE:yyyyMM}. Your job could then name the log file as: /var/log/rundeck_${node.hostname}_${option.datetime}


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/3b61d389-359a-4a92-b29f-209bd9f27479%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Alex Honor

[SimplifyOps, Inc | a...@simplifyops.com ]

Be sure to comment and vote on Rundeck Feature Development!

jerome.pr...@oscaro.com

unread,
Jan 22, 2018, 11:59:50 AM1/22/18
to rundeck-discuss
Hi,

Sorry to dig up this thread, I have similar issue and can't find a solution.

When I put ${DATE:YYYY-MM-dd} in default value of an option, I got the string "${DATE:YYYY-MM-dd}" not the actual date. Is this tip still working ? I'm running 2.8.2.
Reply all
Reply to author
Forward
0 new messages