Forum Discussion
uni_87886
Oct 15, 2013Cirrostratus
I run a perl script from cron, which uses SSH to run a bash script on the remote F5 to create a UCS backup, then SCP to copy the UCS off.
Here's a simplified version of my script:
!/usr/bin/perl
$ip = 10.1.2.3;
$hostname = "myF5";
$remotefile = "/var/tmp/backup.ucs";
$localfile = "/backup/$hostname.ucs";
$cmd = << CMD;
if [ -n "`file -L /bin/bigpipe|grep text`" ]; then
tmsh save /sys ucs $remotefile 2>/dev/null
else
bigpipe config save $remotefile 2>/dev/null
fi
CMD
open SSH, "| /usr/bin/ssh -q -T -o \"ConnectTimeout 10\" -l root $ip";
print SSH "$cmd";
close SSH;
if ($? != 0) {
die "SSH to $hostname failed with $?\n";
}
system("$scp -o \"ConnectTimeout 10\" root\@$ip:$remotefile $localfile 2>/dev/null");
if ($? != 0) {
die "SCP to $hostname failed with $?\n";
}
- F5Zan_89516Oct 17, 2013NimbostratusThanks uni, can you let me know how you have configured it to run as a scheduled task? And what if i want to save it on some smb share for a week and then delete the older ones... I am a windows guy , not much idea on Linux systems :-)