当前位置: 移动技术网 > 网络运营>服务器>Linux > a10 config backup for aXAPI

a10 config backup for aXAPI

2017年12月12日  | 移动技术网网络运营  | 我要评论
#!/bin/bash 
################################################# 
# 
#   script by vincent yu 
#   created at 20140306 
#   a10 config backup for axapi version: 2.1 
# 
# 
################################################# 
a10ip="1.1.1.1 1.1.1.2"
user=admin 
password=a10 
today=`date "+%y%m%d"` 
backupdir=/path/$today 
timenow=`date "+%y%m%d%h%m"` 
log="/tmp/mail"
maillist="ng@ng.com.tw"
 for count in $a10ip do
 method1="method=authenticate&username=$user&password=$password"
 session=`curl -k --data $method1 https://$count/services/rest/v2.1/ | sed -n -e 's/.*\(.*\)<\/session_id>.*/\1/p'` 
 
 if [ ! -d $backupdir ];then
  mkdir -p $backupdir 
 fi
 
 gethost_m="session_id=$session&method=system.hostname.get"
 gethost=`curl -k https://$count/services/rest/v2.1/?$gethost_m | sed -n -e 's/.*\(.*\)<\/hostname>.*/\1/p'` 
 filename="$gethost-$timenow.tar.gz"
 backup_m="session_id=$session&format=json&method=system.backup"
 backup=`curl -k  https://$count/services/rest/v2.1/?$m -o $backupdir/$filename` 
 close_m="session_id=$session&method=session.close"
 close=`curl -k https://$count/services/rest/v2.1/?$close_m` done
 cd $backupdir echo "|----------- a10 system backup notification ------------------|" > $log echo " " >>$log ls -la *.gz | awk '{print $5,$6,$7,$8,$9}' >> $log echo " " >> $log echo "|------------------------------------------------------------------|" >>$log

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网