自動備份Alcatel OmniSwitch設定檔

續之前自動備份FortiGate設定檔
把他改成給Alcatel OmniSwitch使用

#!/bin/bash
user="帳號"
password="密碼"
tftp_ip="tftp的主機"
ac_devices="Alcatel的ip1 Alcatel的ip2"
date="$(date +"%Y%m%d")"

for ac_device in $ac_devices ; do
  expect -c "
  set timeout 10
  spawn ssh $user@$ac_device
  expect \"(yes/no)\" { send \"yes\r\"; exp_continue }
  expect \"*?method:\"
  set send_slow {1 0.05}
  send -s \"$password\r\"
  expect \"*->\"
  send -s \"tftp $tftp_ip put source-file /flash/working/boot.cfg destination-file $date.cfg ascii\n\"
  expect \"*->\"
  send -s \"exit\n\"
  interact"

  mv /home/tftproot/$date.cfg /home/alcatelconfig/$ac_device/$date.cfg
done

[相關文章]

  1. 尚無回應.

  1. 尚無引用.