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!