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:

  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

  6. Test the script by running it in terminal (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

  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/

  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.



# remote server directory to upload backup to (on local machine)

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

# make folder by date for backups
mkdir $NOW

# login to K1000 and perform FTP download of backup files.
ftp -n -i $SERVER <<EOF
type binary
mget kbox_*