Operating System - HP-UX
1827249 Members
2859 Online
109716 Solutions
New Discussion

Re: cron job allocates space in root file system

 
SOLVED
Go to solution
George_206
Frequent Advisor

cron job allocates space in root file system

Dear all,
I have created the following cron job which runs every minute
0 9 * * * /pp3/script_del > /pp3/cron_out 2>&1
but every time it runs it allocates some kbytes in root file system. So if it runs for a couple of weeks root file system can become full. I cannot find how to resolve this.

Can anyone help?
Thanks.
George.
11 REPLIES 11
Dennis Handly
Acclaimed Contributor

Re: cron job allocates space in root file system

It would help if you could explain where it was allocating it. I assume that /pp3/ isn't in root?
Does the script leave anything in /tmp or /var/tmp?
It isn't /var/adm/wtmps, since cron not logged there.
It could be /var/adm/cron/log but that should be small.
Dennis Handly
Acclaimed Contributor

Re: cron job allocates space in root file system

>0 9 * * *

This does it once a day at 9:00 AM. If you really want it to run once a minute and are worried about the space in cron/log, you could start it up once, then use sleep to do it once a minute. And you would have to have it stop before the next restart. Possibly something like:
while true; do
HHMM=$(date +"%H%M")
if [[ $HOUR -gt 850 && $HHMM -lt 900 ]]; then
exit 0
fi
: do something here
# wait for 1 min
sleep $((1*60))
done
George_206
Frequent Advisor

Re: cron job allocates space in root file system

Actually /var is a separate filesystem, so there is no problem with whatever in /var.

I checked /cron/log and deleted content but root fs is the same.

Do you think that it has to do with the script itsef? It actually monitors web server logs searching for patterns (eg. ip) and updates a DB through SQPLUS. INSERT staements are created on the fly acconrding to the data.

Can cron job be executed by another user?
Dennis Handly
Acclaimed Contributor

Re: cron job allocates space in root file system

>I checked .../cron/log and deleted content but root fs is the same.

(Because as you said, that's on /var.)

>Do you think that it has to do with the script itself?

It would have to be. The logs are on /var, even for syslog.

>updates a DB through SQPLUS.

I assume not on /?

>Can cron job be executed by another user?

Well, another copy of it can, since a crontab entry is just a script. In your case, just a line that invokes /pp3/script_del.
George_206
Frequent Advisor

Re: cron job allocates space in root file system

I can also see that used i-nodes fro root are too many. Is it related?

/ (/dev/vg00/lvol3 ) : 12776 total i-nodes
9701 free i-nodes
3075 used i-nodes
31 % i-nodes used
Dennis Handly
Acclaimed Contributor

Re: cron job allocates space in root file system

>I can also see that used i-nodes for root are too many. Is it related?

Is this HFS or VXFS type of filesystem?
I wouldn't think for either it would make that much of a difference.
George_206
Frequent Advisor

Re: cron job allocates space in root file system

It is VxFS
OldSchool
Honored Contributor

Re: cron job allocates space in root file system

the output of "bdf /pp3" might be enlightening, as would the script itself
James R. Ferguson
Acclaimed Contributor
Solution

Re: cron job allocates space in root file system

Hi George:

You have posted this thread in BOTH HP-UX and LINUX! That's not helpful and wastes effort:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1196448

Regards!

...JRF...
George_206
Frequent Advisor

Re: cron job allocates space in root file system

Yes, you are correct.
The problem is that I intially posted in the Linux (but I wanted hp-ux) but I could not find it through the search, so I thought it was not actually posted.

But anyway, I think I have finally found the cause of the problem.

The problem is that in the HP9000 the audit option was ON, so the audit files were increasing every time the cron job was executed. Since the job includes several system commands, which are monitored by the audit, the problem was that a week after the root disk space (where the audit log was located) was significantly minimized.

So I turned the audit OFF and rotated the logs and now it seems that everything is OK.

Thanks everyone for your effort and immediate resonse. I do appreciate.

Now it's time to assign points!!!

Thanks.
George.
George_206
Frequent Advisor

Re: cron job allocates space in root file system

The problem is that in the HP9000 the audit option was ON, so the audit files were increasing every time the cron job was executed. Since the job includes several system commands, which are monitored by the audit, the problem was that a week after the root disk space (where the audit log was located) was significantly minimized.

So I turned the audit OFF and rotated the logs and now it seems that everything is OK.