Forum Discussion
iCall / Automatic Backup Script / How to delete old backup files within iCall script?
Hi all!
I am using an iCall script to automate the configuration backups of BIGIPs. The script runs fine, except for the command to delete the old backup file(s). The exec rm command does not work when trying to delete files. Removing directories works well, but i don´t want to introduce a seperate directory for the backup files. Does anybody know, why the files don´t get deleted with the command in the line below "delete backup files"?
rgds, Peter.
modify script f5.archiving {
app-service none
definition {
delete backup files
exec rm -f /shared/tmp/f5backup*
Set Current Date/Time for Filename
set cdate [clock format [clock seconds] -format "%Y%m%d%H%M%S"]
Pull hostname from config for Filename
set host [tmsh::get_field_value [lindex [tmsh::get_config sys global-settings] 0] hostname]
Create Temp Directory
set tmpdir [exec mktemp -d /shared/tmp/f5backup.XXXXXXXXXX]
Set Filename Root
set fname "f5backup-$host-$cdate"
Export UCS
tmsh::save /sys ucs $tmpdir/$fname
Create Backup
exec tar cvzf /shared/tmp/$fname.tar.gz -C $tmpdir . 2> /dev/null
Remove Temp Directory
exec rm -rf $tmpdir
SSH settings
exec scp /shared/tmp/$fname.tar.gz backup_user@10.128.20.20:/network/backups/f5/
}
description none
events none
}
1 Reply
- Ivan_129704
Nimbostratus
Hi,
Although spent time from your question, I am in the same situation.
The problem is because in the tclsh language you can not use the wilcard *
Try replacing the line
exec rm -f /shared/tmp/f5backup*
By
exec sh -c "rm -f /shared/tmp/f5backup*"
Luck
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
