1833863 Members
2255 Online
110063 Solutions
New Discussion

1G files and larger

 
Mike_21
Frequent Advisor

1G files and larger

I have a cron job being run as user x. The job seems to die at 1073741824 with plenty of disk space available. We are currently running HP-UX 10.20 and the users ulimit settings are listed below. Can anyone explain if any of the below settings be causing this job to stop?

Thanks


$ ulimit -aS
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 244140
stack(kbytes) 20504
memory(kbytes) unlimited
coredump(blocks) 4194303
nofiles(descriptors) 512
$ ulimit -aH
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 244140
stack(kbytes) 20504
memory(kbytes) unlimited
coredump(blocks) unlimited
nofiles(descriptors) 1024
2 REPLIES 2
linuxfan
Honored Contributor

Re: 1G files and larger

Hi Mike,

this is a known bug
Modify your /var/adm/cron/.proto to look like

/Begin/
cd $d
if [ $l -ge 4194303 ]
then
ulimit unlimited
else
ulimit $l
fi
umask $m
$<

/End/

-HTH
I am RU
They think they know but don't. At least I know I don't know - Socrates
Bill Hassell
Honored Contributor

Re: 1G files and larger

This is also a common problem seen when cron jobs don't work but as a logged-in user, they work fine. cron has almost nothing in the environment...see man crontab:

cron supplies a default environment for every shell, defining:

HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh

Wow, that's not much at all. So the first step in debugging a cron job is the env command. It will report the current environment, so make a copy of env for the user and then place it into the cron job. Include ulimit -a too. Then compare the results.

One possibility is to source /etc/profile and/or .profile to set the user's environment, but you'll need to protect tty commands like tabs and ttyset (cron has no tty so these commands report "not a typewriter"). The other is to explicitly set the required values in the cron script. And to avoid running aliased commands or functions, use full pathnames for every command: /usr/bin/grep or /usr/bin/ls)


Bill Hassell, sysadmin