Linux coomand script

Skip to first unread message


Jan 27, 2020, 9:07:20 AM1/27/20
to schedulix
Good morning,

I am converting our tool to schedulix and encountered an issue.  In new scheduler, we typically call linux script along with parameters to remote job server (agent).  In one of parameters, it contains linux command itself (please see below example where the date parameter will be resolved on schedulix server before getting to job server).

Our previous tool works fine with that command by telling it to run as linux shell script but appears it does not work with schedulix.  Script in job server (agent) receives same string parameter (`date +"%m/%d/%Y" --date="1 days ago"` ) instead of 01/26//2020.  
Is there a way to resolve this issue?  If not, I think we might have to handle it in my script.

\usr\bin\ `date +"%m/%d/%Y" --date="1 days ago"` 


Ronald Jeninga

Jan 27, 2020, 9:28:49 AM1/27/20
to schedulix
Hi HV,

it's actually pretty simple, just add a "/bin/bash -c".
Thus the run program would then look like

/bin/bash -c "/usr/bin/ `date +'%m/%d/%Y' --date='1 days ago'`"

Note that I've changed the quoting (and replaced the backslashes with slashes), which will work fine in this example.
The parsing of the run program by the schedulix server is done according to Bourne shell rules.
After the parsing it passes an argv array to the jobserver (which can use this directly in it's execv() call).

I'd regard it a bug if schedulix would pass 01/26/2020 instead of the date call itself.
In case of date it would be a theoretical possibility, but if you replace it e.g. with `cat /tmp/somefile` and the jobserver runs on a remote system it would fail.



PS. I'm curious... Are you allowed to tell me which tool you are converting away from?
Just send me an e-mail if you can't post it here.

Fábio Carvalho

Feb 10, 2020, 11:51:29 AM2/10/20
to schedulix
Thanks Ronald, your answer also helped me.
Reply all
Reply to author
0 new messages