a10 config backup for aXAPI

时间:2021-05-23

#!/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

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章