How to SCP the nightly backup files to external server Automatically from Airwave

By esupport posted Nov 21, 2016 05:33 AM


Need to Transfer the nightly backup from Airwave to an external SCP server every day at 3 am Automatically.


This KB Works for any Airwave version, and need a valid SCP server which can receive files from the Airwave, basically the connectivity.


We could create a simple bash script, with the commands to scp the file to the external SCP server and set a cron job to run that script, every day at 3 am in the morning.


Normally the SCP command will require the username and password to initiate the transfer.  

We cannot manually enter the password every time.  To Automate, we will need the "sshpass" rpm installed on our Airwave, so that we can use it to put the password automatically for us.

We could download the "sshpass" rpm from the below URL:

and I have also attached the URL to this KB, we could just copy the rpm file to any directory on Airwave and execute the below command from that directory:

# rpm -Uvh  sshpass-1.05-1.el6.x86_64.rpm


The SCP command will look like this:

# sshpass -p 'password' scp /var/airwave-backup/nightly_data001.tar.gz  username@<ip of the remote server>:/<backup_directory>/

In the above command, 'password' is the password of the remote server inside single quotes, sshpass tool will provide the password automatically every time this command gets executed, instead of user entering it manually.

This command will transfer the nightly_data001.tar.gz file, which is the latest backup file to the "backup_directory" a directory on the remote server.


Now we could create a simple bash script to run this command, by doing the following:

# vi /tmp/

Note: I am creating this script in /tmp directory, you could create in any directory you prefer.

The above command will open Vi editor, where we can type the content into the file by pressing the alphabet "i" in the key board, which is insert mode. enter the following in the script:

# Script to transfer the file to scp server
sshpass -p '<password>' scp /var/airwave-backup/nightly_data001.tar.gz <username>@<ip of the remote server>:/<backup_directory>/

after typing the above content in the script, we would need to save and exit. by doing the following:

hit the "Esc" key following with ":" (colon)  wq!

once the script is saved, we need to give it executable file permissions by running the below command:

# chmod 755 /tmp/


Now we could Automate this script to run every day at 3 am by editing the cronjob file, by running the below command:

# crontab -e

Press "i" to insert, after # End AMP CRON ENTRIES, we need to type the below:

00 03 * * * /tmp/./

and do the following to save and exit:

hit the "Esc" key following with ":" (colon)  wq!











We could do the following to look at the crotab file, the output of the file should look something like this:


[root@localhost mercury]# crontab -l
15 04 * * * /usr/local/airwave/bin/nightly_maintenance_exclusive /usr/local/airwave/bin/nightly_maintenance


00 03 * * * /tmp/./

[root@localhost mercury]#


1 comment


Nov 08, 2018 11:25 AM

Since newer versions there is no root login anymore. How do I do it on AirWave 8.2.7?