For reference, the Linux system automatically executes the multipart backup script-Linux Enterprise Application-Linux server application information. The following is a detailed description. The following scripts are for learning reference only. You need to add them to the/etc/crontab file and execute the script once a day to automatically execute the page folder under the multipart backup/www/users.
CODE :#! /Usr/bin/perl
$ All_day = 'date ';
Chdir "/www/users /";
@ All = <*>;
@ All = sort @ all;
$ Aaa = @ all;
If ($ aaa % 7 = 0)
{
$ X = int ($ aaa/7 );
}
Else
{
$ X = int ($ aaa/7) + 1;
}
# Print "$ aaa \ n ";
# Print "$ x \ n ";
If ($ all_day = ~ /^ Mon /)
{
Print $ all_day;
For ($ I = 0; $ I <$ x; $ I ++)
{
System "tar czvf/backup/wwwbackup/$all[polici=.tar.gz $ all [$ I] 2>/dev/null ";
}
}
Elsif ($ all_day = ~ /^ Tue /)
{
Print $ all_day;
For ($ I = $ x; $ I <2 * $ x; $ I ++)
{
System "tar czvf/backup/wwwbackup/$all[polici=.tar.gz $ all [$ I] 2>/dev/null ";
}
}
Elsif ($ all_day = ~ /^ Wed /)
{
Print $ all_day;
For ($ I = 2 * $ x; $ I <3 * $ x; $ I ++)
{
System "tar czvf/backup/wwwbackup/$all[polici=.tar.gz $ all [$ I] 2>/dev/null ";
}
}
Elsif ($ all_day = ~ /^ Thu /)
{
Print $ all_day;
For ($ I = 3 * $ x; $ I <4 * $ x; $ I ++)
{
System "tar czvf/backup/wwwbackup/$all[polici=.tar.gz $ all [$ I] 2>/dev/null ";
}
}
Elsif ($ all_day = ~ /^ Fri /)
{
Print $ all_day;
For ($ I = 4 * $ x; $ I <5 * $ x; $ I ++)
{
System "tar czvf/backup/wwwbackup/$all[polici=.tar.gz $ all [$ I] 2>/dev/null ";
}
}
Elsif ($ all_day = ~ /^ Sat /)
{
Print $ all_day;
For ($ I = 5 * $ x; $ I <6 * $ x; $ I ++)
{
System "tar czvf/backup/wwwbackup/$all[polici=.tar.gz $ all [$ I] 2>/dev/null ";
}
}
Elsif ($ all_day = ~ /^ Sun /)
{
Print $ all_day;
For ($ I = 6 * $ x; $ I <7 * $ x; $ I ++)
{
System "tar czvf/backup/wwwbackup/$all[polici=.tar.gz $ all [$ I] 2>/dev/null ";
} |