For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Craig's avatar
Craig
Icon for Nimbostratus rankNimbostratus
Apr 09, 2018

Variables in SSH CLI? Help automating backups

I'm looking for a better way to speed up backups. I have looked into some of the custom scripts and iApps, but all seem a little messy, so I just do them manually. Even if I can speed them up a little bit and come up with a one-size-fits-all command I can run that would work for now. I don't know anything about Bash, Cron, etc. just trying to do something simple that works.

 

Here is what I am doing on each of my devices:

 

tmsh save /sys ucs /var/local/ucs/HOSTNAME-DATE.ucs

 

scp -p /var/local/ucs/HOSTNAME-DATE.ucs USERNAME@FTPSERVER:/home/DIRECTORY/

 

Obviously I have to update the HOSTNAME and DATE manually each time. Can anyone help me with a way to automate this, where HOSTNAME and DATE are automatic, so I can just paste a simple set of commands into each device?

 

2 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus
    scp -p /var/local/ucs/${HOSTNAME}_$(date +%G%m%d_%H%M) USERNAME@FTPSERVER:/home/DIRECTORY/
    
  • Can help you with a simple bash script provided you have a jump server which can reach all your remote F5 servers.

     

    If SSH keys have been exchanged(Passwordless login), the work is more simpler. If not we can go with a simple sshpass to through pwd.

     

    Let me know if you have jump server and key exchanged.