Trying again, slightly modified and some formatting errors corrected;
Login to the device using the admin account, then move to the admin home directory and create a file using vi:
cd /home/admin
vi bigipbackup.sh
Paste the following into the console:
!/bin/bash
/admin/home/bigipbackup.sh
UCS Files will be saved to /var/local/ucs/
SCF Files will be saved to /var/local/scf/
Create current date/time stamp variable
DATETIME="`date +%Y_%m_%d`"
Note the correct ` character must be used above,
this can be found near the top left of most keyboards
just under the [ESCAPE] key.
Uncomment the following line for troubleshooting
echo $DATETIME
Create filename variable
UCS_FILENAME="${DATETIME}_$HOSTNAME"
Uncomment the following line for troubleshooting
echo $UCS_FILENAME
Create a UCS archive with the filename specified above
The file extension will be .ucs – will be available in the GUI
tmsh save sys ucs "${UCS_FILENAME}"
Also create an SCF file with the same filename
The file extension will be .scf – won’t be available in the GUI
tmsh save sys config file "${UCS_FILENAME}.scf"
If you don’t delete these files /var will become full fairly quickly
Change the +31 value (31 days) to whatever suits you
find /var/local/ucs/ –mtime +31 -delete
EOF
Save the file and exit vi;
:w:q
Then make it executable:
chmod 711 bigipbackup.sh
Then modify the admin user’s cron table as necessary based on your needs (paste in the relevant line, not all of them);
crontab –e
@daily /home/admin/bigipbackup.sh >/dev/null 2>&1 Every day
@weekly /home/admin/bigipbackup.sh >/dev/null 2>&1 Every week
@monthly /home/admin/bigipbackup.sh >/dev/null 2>&1 Every month