当前位置: 首页 > news >正文

腾讯云网站建设教学视频教程网站建设怎么分析市场

腾讯云网站建设教学视频教程,网站建设怎么分析市场,规避电子政务门户网站建设的教训,广西壮族自治区成立时间转自#xff1a;http://blog.chinaunix.net/xmlrpc.php?rblog/articleuid26807463id4577034 之前写过 linux下简单的备份的脚本 #xff0c; 最开始一直用着#xff0c; 后来觉得有必要改进下它了#xff0c; 不管是从操作方式上还是工作方式上。有这样的想法是… 转自http://blog.chinaunix.net/xmlrpc.php?rblog/articleuid26807463id4577034    之前写过 linux下简单的备份的脚本  最开始一直用着 后来觉得有必要改进下它了 不管是从操作方式上还是工作方式上。有这样的想法是因为一次备份引起的。 我经历过磁盘损坏的痛苦 花了1500元才勉强将数据拯救回来 于是导致我对备份要求更加高了 我期望尽量每周备份 期望备份的目的地是当前系统的完整镜像也就是说我能够从备份盘启动且启动后系统的操作方法以及文件和当前的一模一样每周我只需要增量备份当前的修改的备份盘这样就安全了很多。于是就有了下面的备份脚本我不喜欢造轮子但是在linux下没有现成的适合我的NOTE 当前还没有加入自动镜像系统所以如果想镜像系统那么可以手动这样操作 准备一块大于当前系统盘的移动盘分区注意分区的结构尽量和系统的一模一样 然后格式化文件系统也尽量相同 然后就可以备份了 备份的时候主要有些目录需要跳过比如sys dev proc等等需要跳过的目录可以在backup程序了面设置这是脚本程序 点击(此处)折叠或打开 #!/bin/bash# This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License as# published by the Free Software Foundation; either version 2 of# the License, or (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# Author: rongp# email: rongpmcu#gmail.com# Date: 2014/10/26# 备份程序# 特点# 主要支持unix类系统下 支持符号链接# 支持增量备份# 支持网络备份由于基于rsync 很容易加入该功能但暂时没加入# 文件名支持空格 但是不能出现含有#的文件名# 支持备份每次的更新方便用于人工操作失误后的修复# 支持添加规则用于剔除某些文件 格式参考rsync的PATTERN部分 SHELL/bin/bashbackup_cfg_path/etcbackup_cfg$backup_cfg_path/backup.cfgdb_pathdb_pathnameinc_path XECHO1 _help() {    echo -e $0 [option]\n\        \tOption:\n\        \t-h show this help.\n\        \t-i perform the installation, and you should use this option\n\        \t before using the backup to do something else.\n\        \t-u perform the un-installation.\n} help() {    echo -e Command action\n\        \th show this help.\n\        \ta add any file that you want to backup to the database.\n\        \td delete any file that you no longer want from the database.\n\        \tb start backup.\n\        \tbf assume \yes\ as answer to all prompts and run non-interactively.\n\        \tn perform a trial backup with no changes made.\n\        \tp print the file record.\n\        \tc do some configurations, such as, modifying the path to the\n\        \t database or to the incremental backup directory.\n\        \ts show the current configuration.\n\        \ti perform the installation, and you should use this option\n\        \t before using the backup to do something else.\n\        \tu perform the un-installation.\n\        \tq quit} color_echo(){    case $1 in         g)            shift            echo -e \033[32m$\033[0m        ;;        gn)            shift            echo -e -n \033[32m$\033[0m        ;;        r)            shift            echo -e \033[31m$\033[0m        ;;        y)            shift            echo -e \033[33m$\033[0m        ;;        yn)            shift            echo -e -n \033[33m$\033[0m        ;;        *)            shift            echo $        ;;    esac} XECHO(){    if [ $XECHO  1 ]; then        echo $    fi} check_src_dst(){    if ! test -e $1 || ! test -e $2; then        color_echo r $1 or $2 does not ignore         return 2    fi     local src_part1df $1 | cut -d   -f 1    local src_part2df $2 | cut -d   -f 1    local nsrc_inodels -lid $1 | cut -d   -f 1    local ndst_inodels -lid $2 | cut -d   -f 1    XECHO nsrc_inode:$nsrc_inode ndst_inode:$ndst_inode     if [ $src_part1 ! $src_part2 ]; then        return 1    fi     if [ $nsrc_inode  $ndst_inode ]; then            color_echo r $src is equivalent to $dst. ignore it!            return 2    fi     if [ ! -e $db_pathname ]; then        return 1    fi     while read -r tsrc tdst tex_src;    do        tsrc${tsrc//#/ }        tdst${tdst//#/ }        tex_src${tex_src//#/ }        XECHO tsrc:$tsrc tdst:$tdst        osrc_inodels -lid $tsrc | cut -d   -f 1        odst_inodels -lid $tdst | cut -d   -f 1        XECHO osrc_inode:$osrc_inode odst_inode:$odst_inode        if [ $nsrc_inode  $osrc_inode -a $ndst_inode  $odst_inode ]; then            if [ ${1:((${#1}-1))}  / -a ${tsrc:((${#tsrc}-1))} ! / ] \                || [ ${1:((${#1}-1))} ! / -a ${tsrc:((${#tsrc}-1))}  / ]; then #/home and /home/ is very                 echo -n ;            else                return 0            fi        fi    done  $db_pathname     return 1 } extract_src_dst(){    XECHO extract src dst from $1     src${1%#*}     dst${1#$src}     dst${dst#\#}     XECHO src: $src    XECHO dst: $dst     if [ $src   -o $dst   ]; then        return 1    else        return 0    fi} fix_path(){    local srcpath$1     if [ ${srcpath:0:1}  / ]; then        echo $srcpath     elif [ ${srcpath:0:2}  ./ ]; then        echo pwd/${srcpath:2}    else         echo pwd/$srcpath    fi} insert_new_item(){    XECHO add item src:$1 dst:$2 exclude:$3    tmp1${1// /#}    tmp2${2// /#}    tmp3${3// /#}    echo $tmp1 $tmp2 $tmp3  $db_pathname    return $?} parse_item(){    if ! extract_src_dst $1; then        color_echo r src:$src or dst:$dst is illegal!        return 1    fi     srcfix_path $src    dstfix_path $dst     XECHO after fixed, src:$src    XECHO after fixed, src:$dst     return 0} do_add() {    local item        color_echo g Enter the mode of adding files! Some patterns are available, as follows:    color_echo g eg: /home/#/tmp/ means we want to backup the whole things which     color_echo g are under home directory to /tmp directory.    color_echo g eg: /home/#/tmp/:/etc/#/tmp/ means we want to backup the whole     color_echo g things which are under the home directory and the /etc/ directory     color_echo g to the /tmp directory, you can append any item with :.    color_echo r Note: /home and /home/ are quite different, because /home just means     color_echo r /home itself while /home/ means the whole contents of /home.     read -p Please type in file items:  items    itemsecho $items | sed s///g     flag0    while [ $flag  0 ];     do         item${items%%:*}        items${items#$item:}        ex_src        if [ $items  $item ]; then             flag1        fi         if parse_item $item; then            check_src_dst $src $dst            ret$?            if [ $ret  0 ]; then                color_echo y Warning! $src#$dst is already existed! do not re-submit!                 continue            elif [ $ret  2 ]; then                continue            fi             read -p Would you like to add some excluding conditions to $src: (y/n)[n]  yn            if [ $yn  y ]; then                color_echo r Note: this is an expert mode, and we dont check your pattern                color_echo r is valid or not. Some patterns are available, as follows:                color_echo r eg: if your src directory is /home, and your want to exclude                color_echo r the directory /home/rongp, then you should type in \rongp\.                 color_echo r eg: if your src directory is /home, and your want to exclude                color_echo r the directory /home/rongp and /home/test, then you should                 color_echo r type in \rongp:test\, and you can append any item with : .                                read -p Please type in paths to the excluding files:  exitem                 ex_src$exitem            fi             if insert_new_item $src $dst $ex_src; then                echo $src#$dst add successed!            else                 echo $src#$dst add failed!            fi        else             read -p skip it? Yy/Nn:[n]  yn            if [ $yn  y -o $yn  Y ]; then                continue            fi            return 1        fi    done     return 0 } get_choices(){    local total_linewc -l $db_pathname | cut -d   -f 1        select_tab    color_echo g Enter the mode of $1! some patterns are available, as follows:    color_echo g eg: 1-3 means select no 1 2 3 item    color_echo g eg: 1:3:5 means select no 1 3 5 item    color_echo g you can append any no with : or -, but dont mix use it.    color_echo g no 0 means select all.    do_print    read -p Please type in the number:  NO    if [ ${NO/-/ } ! $NO ]; then         num_tab(${NO//-/ })        [ ${#num_tab[]} -gt 2 ]  \            echo Select failed, argument $NO is illegal!  return 1                num0${num_tab[0]}        num1${num_tab[1]}        XECHO num0:$num0 num1:$num1         if [ -z ${num0//[0-9]/} -a $num0 -le $total_line -a $num0 -gt 0 ]\            [ -z ${num1//[0-9]/} -a $num1 -le $total_line -a $num1 -gt 0 ]\            [ $num0 -lt $num1 ];         then            select_tab(seq $num0 $num1)        else             echo Select failed, argument $NO is illegal!  return 1        fi    elif [ ${NO/:/ } ! $NO ]; then        for num in ${NO//:/ }        do            if [ -z ${num//[0-9]/} ][ $num -le $total_line ]\                [ $num -gt 0 ]; then                continue            else                 echo Select failed, argument $num is illegal!  return 1            fi        done         j0        for i in ${NO//:/ }        do            select_tab[j]$i            ((j))        done    else         if [ $NO  0 ]; then            select_tab(seq 1 $total_line)        elif [ -z ${NO//[0-9]/} ][ $NO -le $total_line ]\                [ $NO -gt 0 ]; then            select_tab[0]${NO}        else             echo Select failed, argument $NO is illegal!  return 1        fi    fi     return 0} do_del() {    if ! get_choices deleting files; then        return 1    fi     local total_num${#select_tab[]}     if [ $total_num  1 ]; then        nums${select_tab[0]}d    elif [ $total_num  2 ]; then        nums${select_tab[0]},${select_tab[1]}d    else         for ((i0; i$total_num; i))        do            nums${select_tab[i]}d;        done    fi     sed -i $nums $db_pathname /dev/null 21    [ $?  0 ]  echo $NO delete successed! || echo $NO delete failed, delete failed!} do_print(){    [ ! -s $db_pathname ]  color_echo y Warning, no record found!  return 1    echo  no source destination action    cat -n $db_pathname | sed s/#/ /g} check_in_select_tab(){    local i     for ((i0; i${#select_tab[]}; i))    do        XECHO $1:select_tab[$i]:${select_tab[i]}        if [ ${select_tab[i]}  $1 ]; then            return 0        fi    done     return 1} do_backup(){    local ex_filemktemp    local fake${1/fake/-n}    local yes${1/yes/y}     [ ! -f $db_pathname ]  color_echo r $db_pathname does not exist!  return 1     if ! get_choices backup; then        return 1    fi     local i0    local k0    while read -r src dst ex_src;    do        if check_in_select_tab $((i1)); then            XECHO $i in select table            src${src//#/ }            dst${dst//#/ }            XECHO src:$src dst:$dst ex_src:$ex_src ex_file:$ex_file            src_tab[k]$src            dst_tab[k]$dst            ex_src_tab[k]$ex_src            ((k))        fi        ((i))    done  $db_pathname     for ((j0; j$k; j))    do        echo src:${src_tab[j]} dst:${dst_tab[j]} ex_src:${ex_src_tab[j]}        src${src_tab[j]}        dst${dst_tab[j]}        ex_src${ex_src_tab[j]}        echo $ex_src | awk -F : {for (i1;iNF;i)print $i} | sed s/#/ /g  $ex_file         if [ $src  / ]; then            tmpsrc$(blkid mount | grep /  | cut -d   -f 1 | awk -F \ {print $2})        else             tmpsrc$src        fi                if [ $dst / ]; then            tmpdst$(blkid mount | grep /  | cut -d -f 1 | awk -F \ {print $2})        else             tmpdst$dst        fi         color_echo g We will start backup from         color_echo r $src        color_echo g to         color_echo r $dst         color_echo g with excluding file or directory         color_echo r ${ex_src//#/ }        color_echo gn continue or not? y/n:         if [ $yes  y ]; then             yny        else             read yn        fi        if [ $yn  y ]; then            echo Start backup $src to $dst with excluding file or directory $ex_src            (            flock -x 200            rsync -avzrtopg $fake --progress --delete --exclude-from$ex_file \                $src $dst --backup --backup-dir$inc_path/$(date %Y-%m-%d_%H:%M:%S_$(basename ${tmpsrc})_$(basename $tmpdst))            ) 200/var/lock/abc             echo Backup $src to $dst with excluding file or directory $ex_src         else             echo Skip backup $src to $dst with excluding file or directory $        fi    done    } get_answer(){    local ret     if [ $4 !  ]; then        tmpbackup$4    else        tmpbackupbackup.cfg.bak    fi     while :    do        read -p Type in $1 path of the backup(default is $2, q for exit):  ans_tmp         if [ $ans_tmp  q ]; then            ret1            break        elif [ $ans_tmp !  ]; then             if [ ! -d $ans_tmp ]; then                echo $1: $ans_tmp is invalid!                 read -p Would you like to create it now? y/n [y]:  yn                if [ $yn  y ]; then                    mkdir -p $ans_tmp                else                    continue                fi            fi             sed -i s,$3.*,$3$ans_tmp,g $tmpbackup            ret$?            break        else            ans_tmp$2            ret0             break        fi    done     return $ret} already_install(){    if load_cfg $backup_cfg s; then        XECHO already install        return 0 #has install    fi     return 1} do_install(){     color_echo g start install    if already_install; then         color_echo y We check that you have already installed, you should        color_echo yn uninstall first, would you want to uninstall it first?y/n[n]         read yn        if [ $yn ! y ]; then            color_echo g install             color_echo r install             return 1        else             do_uninstall        fi    fi     cp -f backup.cfg backup.cfg.bak    load_cfg backup.cfg.bak s    if [ $?  1 ]; then        exit    fi     if ! get_answer executable file backup $bin_path INSTALL_PATH;then        color_echo g install         color_echo r install         return 1    fi    install_path$ans_tmp    color_echo g install path is $install_path     if ! get_answer database $db_path DB_PATH;then        color_echo g install         color_echo r install         return 1    fi    db_path$ans_tmp    color_echo g database path is $db_path     if ! get_answer incremental backup $inc_path INCREMENTAL_BACKUP_PATH;then        color_echo g install         color_echo r install         return 1    fi    inc_path$ans_tmp    color_echo g incremental backup path is $inc_path     echo     whowhoami    cp backup $install_path    color_echo g install backup to $install_path    ret$?    mv backup.cfg.bak $backup_cfg    color_echo g install $backup_cfg    ret$((ret$?))    mkdir -p $db_path    color_echo g install $db_path    ret$((ret$?))    mkdir -p $inc_path    color_echo g install $inc_path    ret$((ret$?))    ln -s $db_path $inc_path/db    color_echo g install $inc_path/db    ret$((ret$?))    color_echo g install     if [ $ret -gt 0 ]; then         color_echo r install         [ -e $bin_path/backup ]  rm_print $bin_path/backup        [ -e $backup_cfg ]  rm_print $backup_cfg        [ -e $inc_path/db ]  rm_print $inc_path/db  rm_print -rf $inc_path        [ -e $db_pathname ]  rm_print $db_pathname        rm_print -d $db_path        return 1    fi     echo     echo     color_echo y The installation work is done, and you can remove this package now!    color_echo y Note: you should put the executable file \backup\    color_echo y into \$PATH and you need to get \root\ privileges to execute it.    color_echo y for example, you can execute it like this in ubuntu: sudo backup    return 0} rm_print(){    color_echo g remove $    eval rm $} do_uninstall(){    XECHO Perform the un-installation.    color_echo g perform the un-installation...    if ! load_cfg $backup_cfg; then         color_echo g uninstall     fi    [ -e $bin_path/backup ]  rm_print $bin_path/backup    [ -e $backup_cfg ]  rm_print $backup_cfg    [ -e $inc_path/db ]  rm_print $inc_path/db  rm_print -rf $inc_path    [ -e $db_pathname ]  rm_print $db_pathname    rm_print -d $db_path    color_echo g uninstall     color_echo g uninstall } load_cfg(){    if [ ! -e $1 ]; then        [ $2 ! s ]  color_echo r Error, we cant find the configure file $1, exit now!        return 1    fi     bin_pathsed -n s/INSTALL_PATH\(.*\)/\1/p $1    db_pathsed -n s/DB_PATH\(.*\)/\1/p $1    db_pathname$db_path/backup.db    inc_pathsed -n s/INCREMENTAL_BACKUP_PATH\(.*\)/\1/p $1     if [ ! -d $inc_path ]; then         [ $2 ! s ]  color_echo r Load configuration file your should        [ $2 ! s ]  color_echo r check the directory $db_pathname is valid or         return 2    fi     XECHO database path is $db_path    XECHO database file path is $db_pathname    XECHO incremental backup path is $inc_path    return 0} show_configure(){    color_echo g executable backup is in $bin_path    color_echo g database directory is in $db_path    color_echo g incremental backup directory is in $inc_path} do_modify_inc_backup_path(){    if ! get_answer incremental backup $inc_path \        INCREMENTAL_BACKUP_PATH $backup_cfg;then        return 1    fi     inc_path$ans_tmp    XECHO incremental backup is $inc_path    return 0} do_configure(){    color_echo g [1] modify incremental backup path    color_echo g [2] ...    read -p Please type in the no which you are expecting to:  no     if [ $no  1 ]; then        do_modify_inc_backup_path    else        color_echo r Unsupported     fi} backup_start(){    if ! load_cfg $backup_cfg; then         exit    fi     while :    do        read -p Command (h for help):  cmd        case $cmd in            a)                do_add                ;;            d)                do_del                 ;;            p)                do_print                ;;            c)                do_configure                 ;;            b)                do_backup                 ;;            bf)                do_backup yes                 ;;            n)                do_backup fake                ;;            s)                show_configure                ;;            i)                do_install                ;;            u)                do_uninstall                exit                ;;            q)                break                ;;            h | *)                help                 ;;        esac    done} usernameecho $USER if [ $username ! root ]; then    color_echo r Error, you need to have \root\ privileges to execute this program.    exitfi if [ $1  -i ]; then    if ! do_install; then        color_echo y Sorry, We cant continue any more. Exit now!     fi    exitelif [ $1  -u ]; then    do_uninstall     exitelif [ $1  -h ]; then    _help    exitfi if [ ! -e $backup_cfg ]; then     color_echo r $backup_cfg does not exist!     read -p You need to install the backup first. perform the installation? y/n?[y]:  yn     if [ $yn ! n ]; then        do_install    else        echo Sorry, we can\t continue any more. Exit     fi    exitfi backup_start 这是配置文件 点击(此处)折叠或打开 ################################################################AUTHORrongpEMAILrongpmcugmail.comVERSION1.0 INSTALL_PATH/usr/bin/DB_PATH/var/lib/backup/INCREMENTAL_BACKUP_PATH/var/lib/backup/incr_backup git路径gitbitbucket.org:rongpmcu/backup-script-shell.git 【作者】张昺华 【出处】http://www.cnblogs.com/sky-heaven/ 【博客园】 http://www.cnblogs.com/sky-heaven/ 【新浪博客】 http://blog.sina.com.cn/u/2049150530 【知乎】 http://www.zhihu.com/people/zhang-bing-hua 【我的作品---旋转倒立摆】 http://v.youku.com/v_show/id_XODM5NDAzNjQw.html?spma2hzp.8253869.0.0fromy1.7-2 【我的作品---自平衡自动循迹车】 http://v.youku.com/v_show/id_XODM5MzYyNTIw.html?spma2hzp.8253869.0.0fromy1.7-2 【新浪微博】 张昺华--sky 【twitter】 sky2030_ 【facebook】 张昺华 zhangbinghua 本文版权归作者和博客园共有欢迎转载但未经作者同意必须保留此段声明且在文章页面明显位置给出原文连接否则保留追究法律责任的权利.
http://www.yutouwan.com/news/47675/

相关文章:

  • 肥西县建设局资询网站中国室内设计公司排名榜
  • 开发什么网站免费行情软件app网站mnw直
  • 在兔展上怎么做网站页面应用商店网站源码
  • 死链对网站链轮的影响装饰工程包括哪些主要内容
  • 各网站推广做soho外贸网站
  • wordpress网站视频播放磁力蜘蛛种子搜索
  • 淄博企业网站建设价格简述网络营销的方法
  • 外贸网站如何seo推广开发网页游戏平台
  • 南通港闸区城乡建设局网站电商网站定制开发
  • 上海网站的优化公司wordpress加超链接
  • 公家网站模板什么是网站的入口
  • 网站字体大小合适wordpress posted on
  • 买网站需要注意什么商城网站建设预算要多少钱
  • 温州专业微网站制作文登做网站的公司
  • 四川网站建设博客app软件开发的费用设计
  • 做文案策划有些网站wordpress为什么不能显示域名
  • 蒲公英网站建设深圳办公室装修多少钱一个平方
  • 集团酒店网站建设网络管理与维护
  • 17一起来做网站北京网站优化流程
  • 自己做彩票网站合法吗广告设计用什么软件做
  • 有专门做辩论的网站吗上城区网站建设价格
  • 青岛网站建设排名aspx网站模板
  • 哪有做网站 的上海百姓网免费发布信息网
  • 北京哪里有网站建设设计免费做网站支持绑定
  • php 网站后台管理系统长春seo公司哪家好
  • 引流网站建设wordpress 多站点主题
  • ps做阿里网站分辨率设置wordpress如何登陆
  • 网站关闭多久排名会下降如何用Word做网站单页
  • 做银行流水网站网站开发工资低
  • 耐克1网站建设的总体目标深圳网络科技公司大全