Run bash scripts in Sync Post-Job on Windows

It is possible to run .sh files via sysExecute in Sync Post-Jobs on a Windows installation of Sync, but you have to install a third party program such as bash or cygwin on your machine, which will allow the Windows OS to be able to run .sh files. For example, I have bash installed on my machine and below is how I can successfully call a .sh script using bash and sysExecute in Sync:

<api:set attr=“sys.name” value=“C:\\Program Files\\Git\\bin\\bash.exe” />

<api:set attr=“sys.arguments” value=“C:\\Users\\Public\\Documents\\test.sh” />

<api:call op=“sysExecute” in=“sys” out=“result”>

<api:set attr=“_log.info” value=“[result.sys:output]” />

</api:call>

Below is my simple .sh script that waits 5 seconds and then just echos “hello world”:

sleep 5  # Waits 5 seconds.

echo “hello world”

Which is then logged in the app log, after running the task:

9ca9c47d-ce2e-4d86-8caf-048c2aab96d4.png

More details on sysExecute you can find in the following documentation:

https://cdn.cdata.com/help/AZJ/mft/op_SysExecute.html

3 Likes