/build/static/layout/Breadcrumb_cap_w.png

How to setup a process to automatically move K1000 backups to a Red Hat system.

Similar to this Windows process to automatically move files to an off-KBOX location, I wanted a method to do the same in Red Hat with a cron job. 

NOTE: For the purposes of this post, I didn't set any user restrictions on the folders or files where the KBOX backups are stored. You will probably want to modify this in your environment.

Steps to create the backup job:

  1. Log into the RHEL system as root.

  2. Create a location to download the files to.  I used /kboxbackups.

  3. Change the permissions of that location by right clicking on the folder you created to allow access to the FTP shell script we are going to create later. I set mine like this:



  4. Open TextEdit and paste in the script from below.  Modify it to reflect your KBOX IP and backup location under SERVER and BACKUPDIR respectively. I saved it as a .sh file in the /kboxbackups folder for ease of use.  The actual name I used was: kbox-cron-backup-script-linux.sh

  5. Once saved, right click on your script and set permissions like the folder above. In this case, you will also need to check the box for "Allow executing file as program" or do this in terminal for the file: chmod 755 kbox-cron-backup-script-linux.sh

  6. Test the script by running it in terminal (sh kbox-cron-backup-script-linux.sh).  It should put the backup files in the location you specified in a folder that shows today's date (YYMMDD format).  The folder should have 2 files, kbox_dbdata.gz and kbox_file.tz



  7. Create the cron job by opening terminal and typing in: crontab -e -u root

  8. Type the letter "i". That allows you to insert text.

  9. Refer to this cron link for other options, I set mine to run at 4am every day with the string below:

    00 04 * * * /kboxbackups/kbox-cron-backup-script-linux.sh

  10. Once you have inputted your parameters, press escape (Esc), then type : (colon), then wq and press Enter.  It will look similar to the screenshot below before pressing enter after wq:



  11. If you are having trouble getting the cron job to run, you can add this to the following command to the string in #9 to the and it should give you direction on why it's not working: &>/kboxbackups/cron-output

  12. Once it's running successfully, you should have a folder and files like the screenshots on #6 above.

NOTE: These files will not truncate so it is important to delete them on a regular basis so it does not fill the FTP destination.


Script:

#!/bin/sh
USERNAME="kbftp"
PASSWORD="getbxf"
SERVER="192.168.1.175"

# remote server directory to upload backup to (on local machine)
BACKUPDIR="/kboxbackups"

# variable to get date
export NOW=`date +%y%m%d`

# make folder by date for backups
cd $BACKUPDIR
mkdir $NOW

# login to K1000 and perform FTP download of backup files.
ftp -n -i $SERVER <<EOF
user $USERNAME $PASSWORD
type binary
lcd $BACKUPDIR/$NOW
mget kbox_*
quit
EOF
break


Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ