0

Sorry I may be a bit of a newbie here and I have never really ran any cron jobs.

Anyways, I am running an Arch Linux server which has cronie running on it and I have setup this cron job:

10 * * * * sh /home/cron/CronScripts/svnbackup.sh

Which should fire the script 'svnbackup.sh'. However, when I tail -f the logs it shows the following errors:

Dec 16 12:00:01 Aramis /usr/sbin/crond[536]: (root) CAN'T OPEN (/etc/crontab): Too many open files Dec 16 12:00:01 Aramis /usr/sbin/crond[536]: (CRON) OPENDIR FAILED (/etc/cron.d): Too many open files Dec 16 12:00:01 Aramis /usr/sbin/crond[536]: (CRON) OPENDIR FAILED (/var/spool/cron): Too many open files

If I run the script directly it runs fine and does exactly what it was supposed to do, so what is the reason that the cron won't run it?

Any help would be great.

Thanks!

2 Answers 2

3

This isn't a problem with your script, it's a problem with your system. As you might guess from the error, there seem to be too many files open.

Check /proc/sys/fs/file-max to see what your limit currently is. If it's too low, you can reset it using sysctl. Also, add a line to /etc/sysctl.conf to set it at your next boot:

file-max=65536

(for example)

3
  • Is there any way of forcing it to perform that now? I don't really want to have to reboot my server if its unneccessary?
    – DarkMantis
    Commented Dec 16, 2011 at 12:27
  • sysctl fs.file-max=65536 looks like it might be what you want. At least, that's all I see when I sysctl -a | grep file-max in Debian.
    – ghoti
    Commented Dec 16, 2011 at 19:18
  • 2
    You can sysctl -a | less to see everything that you can tune or monitor with this tool.
    – ghoti
    Commented Dec 16, 2011 at 19:19
3

Check the system wild limits with:

cat /proc/sys/fs/file-max

and your personal limit:

ulimit -n

And also you can check what files are open with

lsof
2
  • +1 for ulimit. Important thing to check!
    – Alfabravo
    Commented Dec 16, 2011 at 13:54
  • unlimit doesn't address the OP's issue, since the cron job is running as root.
    – ghoti
    Commented Dec 16, 2011 at 19:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .