- Article History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Alert a Moderator
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Alert a Moderator
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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
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
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
I am Assuming that this will also work for a TFTP server as well?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
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
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
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
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
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
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
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
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
Is there an update to this since 8.2.4 took away root access? I have tried SCP using the ampadmin user, but that doesn't seem to allow that kind of connection.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
Please add FTP functionality into AirWave 8.2.5.1 or get it on the list of feature enhancements. The automated backup transfer is killing me with several clients who are Windows shops. We've installed SCP servers on the Windows server and manual downloads from the AW CLI menu system work just fine, it's the automated backups that are failing. TAC's answer was to install a Linux box to SCP the files to...not a good solution. TAC case #5324310858 for reference.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
Hi answrman, why is it failing? I have airwave doing an automated backup to a windows server with cygwin but it should work with other SCP servers. I had to play around with the SCP command but it seems to be working fine now
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
Hi I had written the same script and running the command given at the end but it is giving an error, any help would be appreciated.
my script file is as follows:
ftp -inv 172.21.100.21<<ENDFTP
user test test123
cd /home/Airwave
lcd /var/airwave-backup
put nightly_data001.tar.gz nightly_data_`date +%m_%d_%y`.tar.gz
bye
ENDFTP
Logs:
/var/airwave/custom/post_nightly_maintenance Connected to 172.21.100.21 (172.21.100.21). 220 Welcome to iict FTP service. 331 Please specify the password. 230 Login successful. 200 Switching to Binary mode. 250 Directory successfully changed. Local directory now /var/airwave-backup local: nightly_data001.tar.gz remote: nightly_data_11_18_17.tar.gz 227 Entering Passive Mode (172,21,100,21,147,214). 553 Could not create file. 221 Goodbye.
All the permissions had been given to the user in the remote system as well as the local sytem.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Alert a Moderator
Just checked at the remote system and set one command
setenforce=0
This has got worked for me.I wanted to post the soultion which i got.
thank you.