存档

文章标签 ‘更新’

网站更新脚本

2011年1月7日 eric 没有评论

shell版本:

nginxs $> cat  upload.sh

#!/bin/bash
usage() {
    echo "basename $0" [-g] [-p] args
    echo "-h"
    echo "print script help"
    echo "-g:"
    echo "   is a gzip filename"
    echo "-p:"
    echo "   File absolute path"
    echo "   must \" \""
    echo "   \"/var/www /var/data\""
    exit 0
}

while getopts "hg:p:" opt; do
   case $opt in
      h)
         usage
         ;;
      g)
         Filename=$OPTARG
      #打包的文件名!
         ;;
      p)
         path=$OPTARG
     #要上传的目录和文件,要输入绝对地址例如 /var/www/123.jpg,/var/www/eric/
         ;;
      :)
         echo "The opt is unknown"
         ;;
      ?)
         echo "ERROR"
         ;;
    esac
done
[ -z $1 ] && usage
tar -Pzcvf $Filename $path 
分类: linux 标签: ,