Date on log

Skip to first unread message

Aug 6, 2021, 4:21:43 PM8/6/21
to schedulix


is possible to have DATE on logfile name ??

something like YYYYMMDD ????


Ronald Jeninga

Aug 8, 2021, 4:46:06 AM8/8/21
to schedulix
Hi Fabio,

there is a system variable called SYSDATE that can be used.
In a non-trigger context it returns the current date and time formatted like YYYYMMDDHHmmSS.
(In a trigger context it returns the seconds since epoch, which enables you to do a bit of date arithmetic).

If you define you log file (and/or error log file) to be e.g. ${LOGDIR}/${JOBID}.${SYSDATE}, it should work.
(LOGDIR is an assumed parameter which you've set at some level, you can also specify a full qualified path or take advantage of the WORKDIR).



Aug 9, 2021, 8:22:22 AM8/9/21
to schedulix
Thanks Ronald!
what i need is just YYYYMMDD (i want generate one log per day).
by now it will help me

thanks again.

Ronald Jeninga

Aug 10, 2021, 2:15:01 AM8/10/21
to schedulix
Hi Fabio,

well in that case you have an alternative, which requires a little more effort, but will probably do exactly what you need.

Let me assume you have a master M.
Now you create a job that calculates the date in format YYYYMMDD; Something like "date +%Y%M%d" would do the job.
You then use the output to set a result parameter (called CTODAY), e.g. 

sdms-set_variable --host $SDMSHOST --port $SDMSPORT --jid $JOBID --key $KEY CTODAY `date +%Y%M%d`

Now you add the new Job to your master M as a child and make sure it runs first.
Alternatively you can create a structure like

 |                 |
CALC_TODAY  --->   M

The next step is to create a parameter TODAY that is a childreference to the Parameter CTODAY of CALC_TODAY.

From here on, you can use TODAY as a parameter in all Jobs below M.


Best regards,

Reply all
Reply to author
0 new messages