Long cronjobs terminate after 2 minutes/Ubuntu 8.10
Chris G
cl at isbd.net
Fri Mar 27 16:33:39 UTC 2009
On Fri, Mar 27, 2009 at 09:53:09AM -0400, Erik Hemdal wrote:
> I use a cronjob to backup several directories on a Ubuntu 8.10 system. This
> is done by a shell script which issues a series of commands on each of
> several subdirectories.
>
> When I run the script in the foreground, it takes about 2 hours to complete,
> and it runs successfully. When I run it in a cronjob, it terminates
> silently without an error after running for about two minutes. I know the
> duration because of timestamps on the files that the job creates. The last
> file written is done 2 minutes after the job starts, then nothing.
>
> I can see that the cronjob begins because I see its entry in
> /var/log/syslog. The top command displays the job running, until it dies.
>
> I've already verified that the script is executable, that the full path to
> the script is given in /etc/crontab, and that the full path to each command
> in the script is also specified. I'm running the script as root. And there
> is an empty line at the end of my /etc/crontab file (this was mentioned in
> one forum post I found as a requirement for cron to work right). I've tried
> running the job with nohup to try to keep it alive. Nothing has been
> successful.
>
> Other brief cronjobs that I run under similar conditions work correctly, but
> they take less than two minutes each to go.
>
> I've found many posts about cronjobs that won't run at all, but I didn't
> find one about jobs that get cut short. I can't think of anything else to
> try to get this to work. Is there a known way to make this work on Ubuntu?
>
> Thanks for any advice or ideas. Erik
>
Have you got your system set up so that cron sends mail to someone
useful? I.e. if there's a cron error do you get to see the error message?
What user owns the crontab file being executed by cron? If it's an
ordinary user then that user should receive mail when *any* text is
output by the cron job. If it's being run by a user who doesn't
normally get mail then add a "MAILTO=<someone who can read mail" to
the beginning of the crontab file and you may get some useful diagnostics.
--
Chris Green
More information about the ubuntu-users
mailing list