Running commands on a schedule

Introduction

This article will show a simple example of running a command on a node according to a schedule and then downloading a file.

The example used here will be to set up a daily task which will gzip the current web server access log and then download that file to the SSH Gateway as a backup.

 

Step 1: Creating an automation

In the admin web UI, navigate to Automations and click Create.

Give the automation a Name, which here will be Gzip access log.

For the Task, start typing execute, then select Execute Remote Command on Node from the list that appears.

In Gateway Node, type in the node you want to run this automation against, here we will do this on an Ubuntu web server.

In the Command field, we will type in gzip -c /var/log/apache2/access.log > /tmp/access.log.gz

 

 

Click on the Schedule tab. This will be a nightly task, so in the At field, type in 00:00. We can leave the other fields blank. 

 

 

Click on the Repeat tab. Change Repeat to DAYS and set Every to 1.
Click Create to make the automation.

 

 

Step 2: Trigger a file download

Click the newly created automation to see the automation flow and click the Plus icon.

 

 

Name the new automation Download access log. The Event will already be filled out as we have chained this to the gzip automation.

Leave Triggers On as Success and enter Download File from Node as the Triggers Task



 

We can leave Conditions blank, but click on the Download File tab.
Enter the same Gateway Node used in the previous automation, then the file that we created from the gzip command (/tmp/access.log.gz).

For Local Folder, we will just enter /tmp for this example.



 

Click Create to complete the automation creation.



 

Step 3: Testing

You can click the green play icon next to the automation to run it immediately.



 

Clicking on Access Log, we can see that both commands were executed successfully.



Have more questions? Submit a request

Comments