Skip to main content
Skip table of contents

Automating Backup Script

The following covers optional automation of backups with Cron.

In this example, the flag -e is used with the backup script and the example password of "supersecretpassword" is used to encrypt the backups. Additionally, the -d flag is used to delete any quantity of backup files over 30 giving 30 days of files. It is recommended to mount a file system path to an S3 bucket and have the backups generated automatically to an S3 bucket.

To automate the backups, do the following:

  1. Edit the /etc/crontab file to schedule the tasks:
    # vim /etc/crontab
  2. Enter the selected run schedule.

    In this example, thee are two entries. One to create the backup that will run at 1AM system time, and another to delete more than 10 log files that runs at 2AM system time.

    #Run Backup
    * 1 * * * root /opt/PrimeKey/support/ -e supersecretpassword
    #Prune backups after 10 total
    * 2 * * * root /opt/PrimeKey/support/ -d 30
  3. To output these entries to log files of their own for testing and validation, use the following entries:
    #Run Backup and log to file
    * 1 * * * root /opt/PrimeKey/support/ -e supersecretpassword >> /var/log/cron.log 2>&1 
    #Prune backups after 10 total and log to file
    * 2 * * * root /opt/PrimeKey/support/ -d 30 >> /var/log/cron2.log 2>&1

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.