Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement the shell script code for backing up the content of a website

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report