Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kron job to remove Tmp files ?? 2

Status
Not open for further replies.

pctekk

MIS
Sep 28, 2002
345
US
is there a simple way to run a kron job to remove tmp
files at specified times of the nite ??

apparently they are causing some this program we run to crash, so each week we have to remove them manually, but would like to do this automatically, and i was told to create/run a "kron" job ?

thanks Gang
 
Normal setup of some versions creates a cron job to cleanup the /tmp area.

Some versions will respond to "crontab -l" with a list of jobs scheduled. (run from root)
And of course cron must be running for it to work. Try
"ps -e | more" to see the list of what is running.

There is a patch for 5.0.4 and 5.0.5 to correct a problem with cron if it appears that everything is otherwise OK.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
there is a cron running w/ that command.
but being new to this, how do we create the file to dump the temp*
files from a folder/directory called

/u1/live/spool ?????

thanks Ed
 
The fastest way would be to add the directory structure you want to clean out to the script that is called by the existing cleanup cron entry. It normally deletes the stuff in /tmp. Add a line "rm /u1/live/spool/*" to parallel the stuff in /tmp.
You could add an entry in the crontab for root and point it to another cleanup script, but that would be overkill.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
Thanks Ed

I will have to find a unix guru to even do that, because
I'm not sure what the "existing cron" is doing now, are they typically run to 'cleanup' ??


Actually the files we need to remove from
/u1/live/spool
are called
munistemp*

So all i do is a
ls munistemp*
to list them
so i assume we can run a
"rm /u1/live/spool/munistemp*"

to the existing cron entry ??

how do/can i modify the existing cron cleanup ?

Thanks Again !!
 
crontab -l to see if there is a cleanup called. If so , note where it is. Move there and edit the file.
You should have several things going on in crontab. Resetting the clock. Maybe a backup. Who knows what all.
You can get to the directory with the crontab, but best not to meddle with it till you get some 'nix experience. That by "cd /usr/spool/cron/crontabs" I think. No machine here with the address right now. Should be a file "root". Which is the entry file for starting jobs in crontab that are owned by root.
The script files that do the actual work are elsewhere. Say like /usr/bin, or /bin, or /usr/lib, or /etc. Like all scripts, they can be put anywhere, and function fine if called correctly and the permissions/ownership are correct.


Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
If you know how to use vi, you can add sometthing like this:
Code:
15 3 * * 0 rm -f /u1/live/spool/munistemp*
at the bottom of this file:
Code:
/usr/spool/cron/crontabs/root
This will clean up your directory every sunday at 03:15 am.
Anyway,
Code:
man crontab

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top