Tag:linux web site
[[Email protected] script]# cat back_web.sh #!/bin/bash#use scp not use password . so do it --> #ssh-keygen -t rsa --> scp -p .ssh/id_rsa.pub [email protected] Machine B's Ip:/root/.ssh/authorized_ keys #mkdir & go to backup##################################### #back Up web mypath= "/var/web_bak" month= ' date +%m ' day= ' date +%d ' year= ' Date +%Y ' hour= ' Date +%h ' min= ' date +%m ' dirname= $year-$month-$day-$hour-$minecho $dirname if [ ! -d "$myPath" ]; then mkdir "$myPath" ficd $myPathmkdir $DIRNAMECD $dirnamemkdir confmkdir webmkdir db##################################### #backup conf filecd /etc/httpdtar -zcvf $myPath/$dirname/ conf/httpd.conf.tgz ./httpd.conf#backup web cd /usr/local/apache2/tar -czf $ mypath/$dirname/web/htdocs.tgz htdocsscp -r $myPath/$dirname [email Protected]:/backup
This article is from the "Technology Life" blog, please be sure to keep this source http://jesnridy.blog.51cto.com/5554751/1441399
A script that backs up a Web site on Linux.