Optional - Automating the Backup Script
NOTE This is one method of automating the backups using the included backup script. PrimeKey does not officially support the expect binary, but provides it as a means of automation.
Optional Automation of Backups with Cron and Expect
To automate the backups, do the following:
- Edit the
/etc/crontabfile to schedule the tasks:
# vim /etc/crontab
- Enter the schedule that you would like to run.
In this example, we have 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.
NOTE You must first record the command with
autoexpect(per the previous section Optional - Using Expect to Automate Backups). Record the command exactly as cron will run it. If you specify full paths with cron, you need to record the command with the same full paths with
#Run Backup * 1 * * * root expect /home/ec2-user/backup_password.exp /opt/PrimeKey/support/system_backup.sh #Prune backups after 10 total * 2 * * * root /opt/PrimeKey/support/system_backup.sh --delete-files 10
- 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 expect /home/ec2-user/backup_password.exp /opt/PrimeKey/support/system_backup.sh >> /var/log/cron.log 2>&1 #Prune backups after 10 total and log to file * 2 * * * root /opt/PrimeKey/support/system_backup.sh --delete-files 10 >> /var/log/cron2.log 2>&1