1
See my need, I have a cron that runs every morning and creates a file.ddmmaaaa.backup on the Linux Kubuntu server, it happens that the hard drive fills up quickly since this backup file has 500MB on average, how to create a cron that deletes files a date earlier than a week from the current date?
I kept thinking about how to do this but I don’t know much about cron and how I could put variables in cron, maybe the solution is script, but rs, I’m also very layy in script.
The Exclude Script would be roughly
delete /folder/file*. backup
Where file* would be with earlier dates
I was browsing the Stack questions and I came up with a solution, I will create a php script with my needs and run in cron
– Marcelo
Exactly, cron is only a utility that performs scheduled tasks. Nothing is programmed in it beyond the periodicity of the tasks that must be performed.
– gfleck
I was browsing the Stack questions and I came up with a solution, I will create a php script with my needs and run in cron
– Marcelo
what script @Marcelo ???
– PauloBoaventura
Yes a php script since this server has an apache and php running :-)
– Marcelo