Need a cron shell script to remove files from directory after certain time...
Posted on 2010-03-30
I need to get a script working that can be CRON'ed to run nightly and look into specific directories and remove any files matching:
*PID.log as the end-name of the file and who's time-stamp is older than 48 hours.
The log directory is in 4 different environments, and I want to make use of our internal script to figure out the directory location...
It can be done with:
# cfgattr get production APPLTMPpath
# cfgattr get development APPLTMPpath
# cfgattr get testing APPLTMPpath
# cfgattr get training APPLTMPpath
So I want a shell script to go into each of our environments, look into the "appltmp" folder and delete any *PID.LOG that is older than 48 hours.
How could one get this working?