TakedaT
asked on
Need to schedule Linux script to remove directories and their contents
Hi,
I am looking for a script that I can schedule on a SuSE Linux Enterprise server that will run on a daily basis at 1am. I need it to look in a certain directory for directories with folder named with the date of 90 days old or older and delete them along with their contents.
This is for a Squid box. Every month or so, I go and delete daily logs that are older than 3 months. Im looking to automate this. Right now, I ssh into the box, and run the following command to remove all directories from the Month of February.
rm -rf /proxy/www/Daily/2013Feb*
If this was vbscript, it would take me a few minutes, but im not so good with linux scripting.
If someone could also tell me how exactly to schedule the job, that would be great.
I am looking for a script that I can schedule on a SuSE Linux Enterprise server that will run on a daily basis at 1am. I need it to look in a certain directory for directories with folder named with the date of 90 days old or older and delete them along with their contents.
This is for a Squid box. Every month or so, I go and delete daily logs that are older than 3 months. Im looking to automate this. Right now, I ssh into the box, and run the following command to remove all directories from the Month of February.
rm -rf /proxy/www/Daily/2013Feb*
If this was vbscript, it would take me a few minutes, but im not so good with linux scripting.
If someone could also tell me how exactly to schedule the job, that would be great.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, got it. I actually googled and found to use 'crontab -e' but the command swill wouldn't run. Adding a space between the last } and the \ seems to have done the trick.
Thanks
Thanks
ASKER