Monitoring, Management & Location Tracking

Push Airwave nightly backup files to FTP server

Introduction : This article talks about pushing the nightly backup files from Airwave to external FTP server

 

Configuration Steps :

 

We will need to install the FTP rpm if it is not installed on Airwave by default.

How do i check if FTP is installed or not?

[root@amp mercury]# rpm -qa | grep ftp

If we see a FTP package then we need not install it, else please find the compatible FTP package for your CentOS version.

Below steps help to understand the version/architecture of the CentOS on which Airwave is built on.

[root@amp mercury]# crr
CentOS release 6.2 (Final)

[root@amp mercury]# uname -i
x86_64

[root@amp mercury]# amp_version
7.7.9



If the Airwave server can reach internet, we can install FTP using the YUM command.

[root@amp mercury]# yum install ftp

If Airwave server is isolated, download the latest FTP package and place it on /root directory of Airwave and run the command below.

[root@amp mercury]# cd /root
[root@amp ~]# rpm -ivh <Name_of_FTP_package>



Once FTP package is installed, please follow the steps below to edit the nightly_maintenance script.


Make a copy of the post_nightly_maintenance.sample file and open it for editting:

# cp /var/airwave/custom/post_nightly_maintenance.sample /var/airwave/custom/post_nightly_maintenance
# vi /var/airwave/custom/post_nightly_maintenance


Paste this to the end of the file:

ftp -inv <ip_address_of_FTP Server><<ENDFTP
user <username> <user_password>
cd <folder_on_FTP_server>
bin
lcd /var/airwave-backup
put nightly_data001.tar.gz nightly_data_`date +%m_%d_%y`.tar.gz
bye
ENDFTP

Note: Fill in the IP address, FTP directory and login credential in the above lines.

To test the script, you can run the below command:

# /var/airwave/custom/post_nightly_maintenance

Note: Once the script completes, you can access the FTP server to verify the copied backup file status.

The script will copy the nightly backup daily with the date in the file name to specified FTP server. It does not overwrite existing nightly backups.

Version History
Revision #:
1 of 1
Last update:
‎07-04-2014 03:02 AM
Updated by:
 
Labels (1)
Contributors
Comments
slickdigits

Thanks for this!  it helps a lot!  I ended up needing to tweak it a bit for it to work for me..  

 

HOST=’hostname’

USER=’username’     

PASSWD='password'

ftp -n $HOST <<END_SCRIPT

quote USER $USER

quote PASS $PASSWD

bin

prompt off

cd Airwave

lcd /var/airwave-backup

put nightly_data001.tar.gz nightly_data_`date +%m_%d_%y`.tar.gz

bye

END_SCRIPT

Pdana

I am Assuming that this will also work for a TFTP server as well?

Thanks for the guide, the script works apart from the 'date +%m_%d_%y' it doesn't replace the string with the current date for the file transfered over FTP.

 

Is this string translated by the FTP client on Airwave or the FTP server i'm using?

 

Thanks

 

Jon

 

 

 

 

 

slickdigits

The date works on our implementation..  here is the exact text from the post_nightly_maintenance (email and password changed)

 

#!/bin/sh
# Copyright (c) 2001-2015, Aruba Networks, Inc.
# This material contains trade secrets and confidential information of Aruba
# Networks, Inc.
# Any use, reproduction, disclosure or dissemination is strictly prohibited
# without the explicit written permission of Aruba Networks, Inc.
# All rights reserved.

# After nightly maintenance, an executable script or program at
# /var/airwave/custom/post_nightly_maintenance will be executed.
# Make sure the script is executable. The executable will be run
# as the 'root' superuser, so be sure that the permissions prevent
# unauthorized users from making modifications to it.

# This sample script will be overwritten any time the system is upgraded or
# reinstalled.

# A common use for this script is to copy nightly backups to another server:
# rsync -a /var/airwave-backup/*001* \
# backup@backupserver.example.com:/backupdir


HOST='ftp.box.com'
USER='email@email.com'
PASSWD='password'
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
bin
prompt off
cd Airwave
lcd /var/airwave-backup
put nightly_data001.tar.gz nightly_data_`date +%m_%d_%y`.tar.gz
bye
END_SCRIPT

 

 

from the FTP site (using box.com) here is an example of the filename:  nightly_data_08_30_15.tar

my script is below and as far as I can see the put statements are the same.

 

ftp -inv 10.170.64.64<<ENDFTP
user airwave airwave
cd airwave
bin
lcd /var/airwave-backup
put nightly_data001.tar.gz nightly_data_'date +%m_%d_%y'.tar.gz
bye
ENDFTP

apkeene

Getting an error
[root@svpitcairw1 custom]# /var/airwave/custom/post_nightly_maintenance
/var/airwave/custom/post_nightly_maintenance: line 26: warning: here-document at line 19 delimited by end-of-file (wanted `ENDFTP')
/var/airwave/custom/post_nightly_maintenance: line 19: ftp: command not found

Search Airheads
Showing results for 
Search instead for 
Did you mean: 
Is this a frequent problem?

Request an official Aruba knowledge base article to be written by our experts.