zoukankan      html  css  js  c++  java
  • 超级简单的 linux网站备份脚本 shell

    #!/bin/bash
    #Shell Command For Backup MySQL Database Everyday Automatically By Crontab
    #Author : Linsong
    #Date : 2011-10-11
    service mysqld stop
    filedate=`date +%Y%m%d`
    mkdir -p /home/backup/$filedate
    tar -zcvf /home/backup/$filedate/web.tar.gz /var/www/HTML/web/
    tar -zcvf /home/backup/$filedate/mysql.tar.gz /var/lib/mysql/

    chown -R www:www /home/backup/$filedate

    rm -rf /etc/httpd/conf/httpd-for-backup.conf

    echo "<VirtualHost *:80>" >> /etc/httpd/conf/httpd-for-backup.conf
    echo "ServerAdmin webmaster@dummy-host.example.com" >> /etc/httpd/conf/httpd-for-backup.conf
    echo "DocumentRoot /home/backup/$filedate" >> /etc/httpd/conf/httpd-for-backup.conf
    echo "ServerName download.web.com" >> /etc/httpd/conf/httpd-for-backup.conf
    echo "ErrorLog logs/download.web.com-error_log" >> /etc/httpd/conf/httpd-for-backup.conf
    echo "CustomLog logs/download.web.com-access_log common" >> /etc/httpd/conf/httpd-for-backup.conf
    echo "</VirtualHost>" >> /etc/httpd/conf/httpd-for-backup.conf

    service mysqld start

    service httpd restart

  • 相关阅读:
    excel生成csv后,0001变成1
    windows_server_2012_r2提示api-ms-win-crt-runtime-l1-1-0.dll 丢失
    py文件生成exe程序
    朴素贝叶斯分类(上)
    01 | 数据分析全景图及修炼指南
    BBS
    BBS
    BBS
    BBS
    BBS
  • 原文地址:https://www.cnblogs.com/myphoebe/p/2229986.html
Copyright © 2011-2022 走看看