今天看啥
热点:

  备份脚本:

  备份网站内容

  #!/bin/bash

  #指定运行的脚本shell

  #运行脚本要给用户执行权限

  bakdir=/backup

  month=`date +%m`

  day=`date +%d`

  year=`date +%Y`

  hour=`date +%k`

  min=`date +%M`

  dirname=$year-$month-$day-$hour-$min

  mkdir $bakdir/$dirname

  mkdir $bakdir/$dirname/conf

  mkdir $bakdir/$dirname/web

  mkdir $bakdir/$dirname/db

  #备份conf,检测通过

  gzupload=upload.tgz

  cp /opt/apache2/conf/httpd.conf $bakdir/$dirname/conf/httpd.conf

  cd /opt/apache2/htdocs/php

  tar -zcvf $bakdir/$dirname/web/$gzupload ./upload

  #远程拷贝的目录要有可写权限

  scp -r /backup/$dirname root@10.1.1.178:/backup

  备份数据库:

  #!/bin/bash

  #指定运行的脚本shell

  #运行脚本要给用户执行权限

  bakdir=/backup

  month=`date +%m`

  day=`date +%d`

  year=`date +%Y`

  hour=`date +%k`

  min=`date +%M`

  dirname=$year-$month-$day-$hour-$min

  mkdir $bakdir/$dirname

  mkdir $bakdir/$dirname/conf

  mkdir $bakdir/$dirname/web

  mkdir $bakdir/$dirname/db

  #热备份数据库

  cp /opt/mysql/my.cnf $bakdir/$dirname/db/my.cnf

  cd /opt/mysql

  mysqldump --opt -u zhy -p --password=1986 test>$bakdir/$dirname/db/test.sql

  mysqldump --opt -u zhy -p --password=1986 phpwind>$bakdir/$dirname/db/phpwind.sql

  #远程拷贝的目录要有可写权限

  scp -r /backup/$dirname root@10.1.1.178:/backup

www.bkjia.comtruehttp://www.bkjia.com/jinghua/jinghua_65619.htmlTechArticle备份脚本: 备份网站内容 #!/bin/bash #指定运行的脚本shell #运行脚本要给用户执行权限 bakdir=/backup month=`date +%m` day=`date +%d` year=`date +%Y` hour...

相关文章

    暂无相关文章
相关搜索:
相关频道:

帮客评论

视觉看点