Writing Scripts
VI delbak.sh
The code is as follows :
#!/bin/sh
location= "/home/mysql/backup/"
Find $location-mtime +7-type f |xargs rm-f
explanation :
Location is the directory where the lookup is set
--mtime +7 is set to 7 days ago (delete files from location- specific directory 7 days ago )
-type f The type of lookup is file
The code is as follows :
#!/bin/sh
location= "/home/mysql/backup/"
Find $location-mtime +7-name "*.zip" |xargs RM-RF
-name "*.zip" to find files with a zip suffix for file names
timed Call Script
Direct Input Command:
Crontab-e Editing timed Tasks
Crontab-l Viewing timed Tasks
Crontab timed call script eg:
0 1 * * 1/bin/sh/home/mysql/backup/delbak.sh
Execute script delbak.sh every Monday wee 1 o ' Night
Questions:
If this is not possible, it may be a permissions issue, giving the script permission
chmod 777 delbak.sh
Linux is called shell script to delete files