Run Bash Script Using XML, ANT and Ambience 4.x Scheduler

How To Run Bash Script Using XML, ANT and Ambience 4.x Scheduler

In this post, I’ll share how to call out an external bash script using XML, ANT and Ambience 4.x Scheduler.

In this example, we are going to get Ambience Designer to create a new file onto the Linux directory /root/temp.

I am using root user and therefore I’ll create a temp sub folder under root account.

Step 1: Create an XML file In one of the folders

  1. Copy and paste the following into the xml file you created. You’ll need to create a new sub directory /temp

  2. The directory where the file is going to be execute should be /root/temp/

  3. XML code - execSH.xml


<?xml version="1.0"?>

<project name"testProject" default="testInfo">
  <target name = "testInfo">
  <exec dir = "/root/temp" executable = "/bin/bash">
  <arg value = ""/>
  1. Sample bash script -

  2. This will create a newFile.txt in /root/temp when executed.



touch newFile.txt
  1. This is the directory where Ambience will execute the bash script.


Step 2: Ensure Path Name for Name and Build Target is valid

  1. Ensure Build Target field would be the Target Name that is specified in the XML file. Click REFRESH if it is not there.

  2. Make sure the PATHNAME in the Name field can be found in the repository on the left.

Step 3: Right Click Job and Select Run

  1. Right click on Job-RunSH.job and select run.


  1. If the job is executed and it is successful. A newFile.txt will be created in /root/temp as shown below.


  1. You can view the log if an exception or an error has occurred.


  1. This can be found under the Logs menu

  1. The default directory is /tmp for Ubuntu if you use the code <exec dir = “.”


Resources: (860 Bytes)