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

Back up the company's web site plan at 07:00 every morning

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

In order to prevent the website from becoming unavailable due to unexpected situations, the whole tomcat site is backed up every day.

Write a script and put it in the / etc/rc.d/ directory with the name rotate.sh

In order to prevent the daily backup from taking up too much space, delete the backup before 4 days every day and roll back the operation.

1. Write a script rotate.sh

#! / bin/sh

PATH=$PATH:/bin:/sbin

Export PATH

Year= `date +% Y`

Month= `date +% b`

Day= `date +% d`

Now1=$year-$month-$day

Now=$day/$month/$year

Cd / mnt/backup

Find. /-type f-mtime + 3-exec rm {}\

Cd / mnt/backup/

Tar zcvf aidonghtml$now1.gz / mnt/tomcat/

# mysqldump-uroot-p6112911218 aidong > aidong$now1.sql

# mysqldump-uroot-p6112911218 aidong2 > aidong2 $now1.sql

# tar zcvf aidong$now1.gz aidong$now1.sql

# tar zcvf aidong2 $now1.gz aidong2 $now1.sql

# rm-rf * .sql

two。 Execute the task plan and execute the above script at 07:07 every morning

# crontab-l

7 7 * / etc/rc.d/rotate.sh

3. View the results of daily execution

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

Network Security

Wechat

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

12
Report