The Linux backup server saves the DB backup file for one month. It needs to delete the backup one month before. The following is an automatic deletion script.
Statement: find corresponding directory-mtime + days-name “filename” -exec rm -rf {} \\;
Example 1: find /root/Backup -mtime + 30 -name “*.*” -exec rm -rf {} \\; Delete all files in the /root/Backup directory with ”.” 30 days ago
find:linux lookup Command, the user finds the file with the specified condition /root/Backup: the directory to be cleaned up -mtime: standard statement +30: find the file 30 days ago, here the number represents the number of days “*.*“: hope to find The data type, ”*.jpg” means to find all files with the extension jpg, ”*” means to find all files - exec: fixed writing rm -rf: force delete files, including directory {} \\; : fixed Write, a pair of braces + space + \\ +;
write to the shell script, then set crontab execution, then you can let the system automatically clean up the relevant files
Create a new automatic delete script AutoDelBackup.sh
#!/bin/bashfind /root/Backup -mtime +30 -name "*.*" -exec rm -rf {} \\;
#crontab -e* 2 * * * /root/AutoDelBac Kup.sh executes script every day at 2am
1. Disable root user login ssh #vi /etc/ssh/sshd_config Change PermitRootLogin yes to PermitRootLog
If you want to try a desktop system other than Mac and Windows, Linux should definitely be your fir
The icons in the upper left corner of Windows 7 Explorer are Favorites, Desktops, and various Librar
For beginners, the learning of Linux commands is not so simple. Many beginners rarely use commands o
Linux system security optimization in several directions
USB to serial port under virtual machine
64-bit Ubuntu can not install 32-bit compatible library solution
Taiwan's Linux Education Revolution
Windows under the wrong formatted Linux SWAP partition recovery
Ubuntu scim Chinese input method installation detailed tutorial
Linux diskless boot method detailed
Talking about the clock debugging in the driver development
Tip: Linux personalized face clock display
How beginners learn Linux system command operations
Win10 how to solve the splash screen when playing League of Legends?
How many cyber attacks are known? Those hackers like to attack the port's precautions.
Linux how to delete the replacement variable value
Windows 7 system: Quickly open local connections
U disk prompts to solve the formatting steps
Unable to reinstall the system, the prompt is not windows but Windows.x.
Win8/8.1 how to right add WD scanning function
Win7 system, my computer properties can not be opened how to solve?
How do I start the PrintSpooler service before installing the printer driver on my Win7 system?