How to implement the shell script code for backing up the content of a website
This article mainly introduces how to achieve the backup site content of the shell script code, the article introduces in great detail, has a certain reference value, interested friends must read it!
Back up the content of the website
The code is as follows:
#! / bin/bash# specifies the running script shell# to run the script to give the user permission to execute bakdir=/backupmonth= `date +% m`day =% d`year = `date +% Y`hour = `date +% k`min = `date +% M`dirname = $year-$month-$day-$hour-$minmkdir $bakdir/$dirnamemkdir $bakdir/$dirname/confmkdir $bakdir/$dirname/webmkdir $bakdir/$dirname/db# backup conf Check that directories copied remotely through gzupload=upload.tgzcp / opt/apache2/conf/httpd.conf $bakdir/$dirname/conf/httpd.confcd / opt/apache2/htdocs/phptar-zcvf $bakdir/$dirname/web/$gzupload. / upload# must have writeable permissions scp-r / backup/$dirname root@10.1.1.178:/backup and above are all the contents of the article "how to implement shell script code for backing up website content" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!