Hi Thomas, sorry to say but a short script is the only way to go here.
The && doesn't work when we try and pass it to /usr/bin/bash as an argument.
This works interactively because the shell you are using to run the command does not pass && down
to the program being started, but treats the && and what comes after as a command to itself.
-tj
From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> on behalf of Thomas Hartmann <thomas.hartmann@xxxxxxx>
Sent: Wednesday, March 3, 2021 4:53 AM To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx> Subject: [HTCondor-users] shell pipe/cmd-chain as job command/argument in python bindings Hi all,
I just tried to submit a quick job with the Python bindings, where I attempted to run just a few shell commands. I juggled a bit with the position of the execs in the `Cmd` and `Args` keys - but all failed [1] So, I tried to wrap the &&-chained commands into one string-argument and use the shell as executable [2] (not the most elegant approach...). However, it also failed for me :-/ (I guss the behaviour is similar for submissions through the CLI) Is there a way to get it running - or is a short script the only way to go...? Cheers, Thomas [1] jobAd["Cmd"] = '/usr/bin/env' jobAd["Args"] = '&& /usr/bin/cat .job.ad && echo "FOO" ' schedd.submit(job_ad) which actually cat'ed me `echo` - I guess the shell interpretation of operators like `&&` is not possible here, or? [2] jobAd["Cmd"] = '/usr/bin/bash' jobAd["Args"] = '-c "/usr/bin/cat .job.ad && /usr/bin/echo \FOO\"" ' |