1828248 Members
2736 Online
109975 Solutions
New Discussion

Cleaning /tmp directory

 
SOLVED
Go to solution
Roland Piette
Regular Advisor

Cleaning /tmp directory

Hi everybody,

I have install a little script witch creates logfile in /tmp directory every days. I would like to keep they for a month. But after few days these files disappear !
I look in every cronfile and cannot found out any instruction for the cleaning of the /tmp directory.

How it is possible ?

I run with Linux Enterprise AS (v4).

Thanks for your help
Roland
5 REPLIES 5
Hans van Zijst
Advisor
Solution

Re: Cleaning /tmp directory

Hi Roland,

There's probably a script running which cleans out /tmp every now and then. I don't use RedHat, but I can imagine that they too have an /etc/cron.daily directory which contains scripts that are run once every day. This way you don't litter your personal crontab with every day maintenance, but also makes it a little more difficult to see what actually happens.

My guess would be to check for directories like /etc/cron.daily and /etc/cron.weekly and see if it contains cleanup scripts.

Greetings,

Hans
l'apprenti sorcier
Ivan Ferreira
Honored Contributor

Re: Cleaning /tmp directory

Check the tmpwatch file. The file is located in /etc/cron.daily/tmpwatch.

You can add an exclusion for your directory with the -x option.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
g33k
Valued Contributor

Re: Cleaning /tmp directory

IMHO /tmp is not good place to store anything... well sometimes can be usefull, but not to store some logfile....
I would rader use /var/log (it's more standard way).
Roland Piette
Regular Advisor

Re: Cleaning /tmp directory

HI all,

I found it in /etc/cron.dayly/tmpwatch.

Thanks to give me this quick answer.

Roland
Roland Piette
Regular Advisor

Re: Cleaning /tmp directory

Thanks