Back up cacti to schedule tasks for windows

Source: Internet
Author: User

SetBack up cactiAfter importing the RRD file, we canWindowsPlan the task. Let's take a look at the specific steps!

@ Echo off

Rem ============================================== ========================================================

Rem backup cacti Database

Rem perfectaction

Rem User Name

Set User = root

Rem Password

Set pwd = Abc.123

Rem Database Name

Set database_name = cacti

Rem backup path

Set backup_path = D: \ cacti_mysql_bak \ cacti_bak \

Rem obtains the current system time string. It is applicable to the win2003 Chinese version or the win2003 English version with the Oriental Language Pack Installed.

Set now = % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2% _ % time :~ 0, 2% % time :~ 3,2% % time :~ 6, 2%

Rem mysqldump installation directory

Set mysqldump_Path = "C: \ Program Files \ MySQL Server 5.0 \ bin \"

Rem executes the BACKUP command

% Mysqldump_Path % mysqldump-u % User %-p % pwd % database_name %> % backup_path % database_name % _ % now % _ bak. SQL

Rem ============================================== ========================================================

Rem ============================================== ========================================================

Rem deletes expired cacti backups, which are retained for only one month

Forfiles/p % backup_path %/s/m *. */d-31/c "cmd/c del @ file"

Rem ============================================== ========================================================

Rem ============================================== ========================================================

Rem backup rrd File

Copy C: \ Apache2 \ htdocs \ cacti \ rra \ *. * D: \ cacti_mysql_bak \ rra_bak \/y

Rem ============================================== ========================================================

Rem pause

Through the analysis in the above article, we have learned a skill: Back up cacti to schedule tasks for windows! Share it with friends!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.