[comp.unix.questions] running an NNTP program from crontab

rcardena@oracle.com (Ricardo Cardenas) (09/19/90)

Hi wizards, I have a problem you might help me resolve.  I have an ELISP
(emacs lisp) program that uses a news-reader (GNUS) and tries to connect
out to a newshost server via NNTP.  When I run it from the shell command
line, it works beautifully.  It also works fine when I put it in the
background from the command line.

Now I want it to run automatically from crontab, but it hangs for hours
when trying to open the NNTP connection.  Then the program dies, never
having connected.  The same thing happens if I put my program into the
background FROM A SHELL SCRIPT (as opposed to from the command line,
where it works fine).

What differences are there when running with crontab as opposed to
running directly from the shell?  Anything I should be aware of?  I
posted the following to gnu.emacs.gnus but noone has been able to help
me.  Thanks in advance,

Ricardo rcardena@oracle.com
(please email if possible)


Newsgroups: gnu.emacs.gnus
From: rcardena@oracle.com (Ricardo Cardenas)
Subject: HELP: trying to run a GNUS elisp program from crontab
Organization: Oracle Corp.
Distribution: gnu
Date: Sat, 15 Sep 90 23:33:37 GMT

  gnus-batch-kill (in gnus.el) works well from the cmd line.  Now I am
trying to get it to run from crontab.  But it hangs.

  It's getting stuck in trying to establish the connection to the NNTP
server (I checked the output).  It just hangs.  Any reason the
connection can't be established when running the program from cron ?  Am
I missing something?  I have a Sun-3/80, Emacs 18.55.1, GNUS 3.13, NNTP
3.10. Thanks, please email if you can help..

Ricky rcardena@oracle.com

------------------------------------------------------------------------

here's ps ux output:

USER       PID %CPU %MEM   SZ  RSS TT STAT START  TIME COMMAND
rcardena  7440 72.8  5.1  520  344 ?  R N  16:07  13:49 /bin/emacs -batch -l /elisp/gnus -f gnus-batch-kill talk.bizarre
rcardena  7439  0.0  0.4   32   24 ?  I N  16:07   0:00 sh -c /bin/emacs -batch -l /elisp/gnus -f gnus-batch-kill talk.bizarre


and here's my personal crontab entry

0 16 * * * /bin/emacs -batch -l /elisp/gnus -f gnus-batch-kill talk.bizarre

--
Ricardo Cardenas        \\/\    INTERNET: rcardena@oracle.com
Oracle Corp.             \/\\     USENET: uunet!oracle!rcardena
Redwood Shores, CA, USA     \\

gorpong@ping.uucp (Gordon C. Galligher) (09/22/90)

In article <RCARDENA.90Sep18163424@inti.oracle.com> rcardena@oracle.com (Ricardo Cardenas) writes:
>
>What differences are there when running with crontab as opposed to
>running directly from the shell?  Anything I should be aware of?  I
>posted the following to gnu.emacs.gnus but noone has been able to help
>me.  Thanks in advance,
>

One of the major differences is terminal attachment.  When you execute it
in the shell, it has a controlling terminal (namely yours).  When you
background it, it also has a controlling terminal.  When jobs are executed
from cron, they do not have controlling terminals.  Gnu-emacs may attempt
to do things with a terminal, which it does not have.  In your 'ps' listing:

>USER       PID %CPU %MEM   SZ  RSS TT STAT START  TIME COMMAND
>rcardena  7440 72.8  5.1  520  344 ?  R N  16:07  13:49 /bin/emacs -batch -l /elisp/gnus -f gnus-batch-kill talk.bizarre
>rcardena  7439  0.0  0.4   32   24 ?  I N  16:07   0:00 sh -c /bin/emacs -batch -l /elisp/gnus -f gnus-batch-kill talk.bizarre
                                    ^^
It shows no controlling terminal.  This may have nothing to do with your
problem, but it is definitely something different from a shell and cron job.
I do hope this helps, and if not you directly, I hope it will jog someone's
memory into figuring out the problem.

		-- Gordon.

-- 
Gordon C. Galligher	9127 Potter Rd. #2E	Des. Plaines, Ill.    60016-4881
     telxon!ping%gorpong@uunet.uu.net (not tested)  (Is this even legal??)
     ...!uunet!telxon!ping!gorpong      (tested)    (And it works!)
"It seems to me, Golan, that the advance of civilization is nothing but an
 exercise in the limiting of privacy." - Janov Pelorat -- _Foundation's Edge_