• h3c 备份脚本


    #!/bin/bash
    #0 0 1,10,22 * * /it_data3/h3c_backup.sh &       #添加到计划任务                                                                                                                                                                                                       
    datetime=`date +%Y%m%d`                                                                                                                                                                                                 
    BAKTIME=`date +%Y%m%d%H%M%S`                                                                                                                                                                                            
    user="admin"                                                                                                                                                                                                            
    password="123456"                                                                                                                                                                                                   
    back="dis cu"                                                                                                                                                                                                           
    BAK_DIR=/it_data3/H3C_back                                                                                                                                                                                              
    mkdir $BAK_DIR/MY_H3C_$datetime                                                                                                                                                                                         
    for i in $(cat h3c_ip_file)                                                                                                                                                                                             
                                                                                                                                                                                                                            
    do                                                                                                                                                                                                                      
                                                                                                                                                                                                                            
    ping -c 10 $i >/it_data3/cc                                                                                                                                                                                             
                                                                                                                                                                                                                            
    ping_fail=$(cat /it_data3/cc | grep Unreachable | awk '{print $6}' |tail -1)                                                                                                                                            
                                                                                                                                                                                                                            
    if [[ $ping_fail == Unreachable ]] ;                                                                                                                                                                                    
    then                                                                                                                                                                                                                    
       ping -c 50 $i                                                                                                                                                                                                        
    else                                                                                                                                                                                                                    
       echo "PING_SUSS"                                                                                                                                                                                                     
    fi                                                                                                                                                                                                                      
                                                                                                                                                                                                                            
    {                                                                                                                                                                                                                       
    echo $user;                                                                                                                                                                                                             
                                                                                                                                                                                                                            
    sleep 1;                                                                                                                                                                                                                
                                                                                                                                                                                                                            
    echo $password;                                                                                                                                                                                                         
                                                                                                                                                                                                                            
    sleep 1;                                                                                                                                                                                                                
                                                                                                                                                                                                                            
    echo $back;                                                                                                                                                                                                             
                                                                                                                                                                                                                            
    sleep 1;                                                                                                                                                                                                                
                                                                                                                                                                                                                            
    echo "                                                                                                                                                                                                                 ";
                                                                                                                                                                                                                            
    sleep 5;                                                                                                                                                                                                                
                                                                                                                                                                                                                            
    }|telnet $i > $BAK_DIR/MY_H3C_$datetime/$i-$BAKTIME.cfg                                                                                                                                                                 
    tail -n +18 $BAK_DIR/MY_H3C_$datetime/$i-$BAKTIME.cfg > $BAK_DIR/MY_H3C_$datetime/MY-$i-$BAKTIME.cfg                                                                                                                    
    rm -rf $BAK_DIR/MY_H3C_$datetime/$i-$BAKTIME.cfg                                                                                                                                                                        
    done

  • 相关阅读:
    pysam操作sam文件
    NCBI SRA数据库
    通过bed文件获取fasta序列
    利用mysql客户端查询UCSC数据库
    Biopython常用功能模块
    FASTX-Toolkit组件用法
    SQL HAVING用法详解
    jquery获取、改变元素属性值
    《JavaScript DOM编程艺术》
    sublime text3使用心得及个人配置 sublime常用快捷键大全
  • 原文地址:https://www.cnblogs.com/xl-892694298/p/11018853.html
Copyright © 2020-2023  润新知