Forum Discussion
Donald_Rogers_2
Jan 22, 2014Nimbostratus
Here is the one I use on Version 11.2.1
!/bin/bash daily_backup.sh A shell scrpt that takes a daily backup of the system configuration and FTP's the file off to a ftp server, in the event of a system failure and the system needs to be restored. This job will also delete files older than 45 days from the device itself. Get the Hostname of the deviceHOST=$HOSTNAME
Get today's date.DATE=
date +%m%d
Get the passphrase to encrypt the file with.
passph=
cat /root/passph
set the local directory
LDIR="/var/local/ucs/"
set daily directoryDDIR="/var/local/ucs/daily/"
Backup configuration filestmsh save sys ucs $LDIR$HOST.ucs passphrase $passph
backup config for archivalmv $LDIR$HOST.ucs $DDIR$HOST.$DATE.ucs
Delete older files/usr/bin/find /var/local/ucs/daily/ -mtime +45 -exec rm {} \;
Set config paramsUSER= PASS=
Push config file to FTP Servercd $DDIR ftp -nv ..com<< SCRIPT quote USER $USER quote PASS $PASS bin cd $HOST put $HOST.$DATE.ucs quit SCRIPT
exit 1
and then add the crontab -e command and add in this line 20 23 * * * bash /var/scripts/daily_backup.sh
This can be easily modified to save to a local directory and not a ftp server.