How to get a date from a Rundeck job

I am trying to achieve something similar in the rundeck 2.6 task:

touch /foo/bar/${DATE:MM/dd/yyyy}-baz

but it does not work properly and the date is not interpreted at all. Is there any way to do this?

+4
source share
2 answers

You can use this bash script:

#!/bin/bash
touch /foo/bar/`date "+%m/%d/%Y"`-baz

Backquotes act as a substitute for teams and replace the output datein a team touch.

According to the date page :

"" (+ +) ,       . , strftime (3),       .

:

  • % m ( 01 12). (            tm_mon.)
  • % d ( 01 31).           ( tm_mday.)
  • % Y , .           ( tm_year)
+4

, . . :

<option name="date" value="${DATE:MM/dd/yyyy}-baz" />

${option.date}.

0

Source: https://habr.com/ru/post/1664563/


All Articles