* gnus-agent-fetch in batch mode in a cron job
@ 2013-02-13 22:08 Julien Cubizolles
2013-02-20 16:39 ` W. Greenhouse
0 siblings, 1 reply; 5+ messages in thread
From: Julien Cubizolles @ 2013-02-13 22:08 UTC (permalink / raw)
To: info-gnus-english
The subject says it all. I'm fetching news through emacs in batch mode
in a cron job but I can't figure out how to get the possible errors
through the mails sent by cron.
In batch mode emacs output everything that should go to the *Messages*
buffer to stderr so cron sends an email each time the job is run, even
without any error. I don't want to receive an email when there is no
problem. Is there a way to get emacs to send only the error messages to
stderr ?
Julien.
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gnus-agent-fetch in batch mode in a cron job
2013-02-13 22:08 gnus-agent-fetch in batch mode in a cron job Julien Cubizolles
@ 2013-02-20 16:39 ` W. Greenhouse
2013-02-22 6:10 ` Julien Cubizolles
[not found] ` <mailman.20575.1361513992.855.info-gnus-english@gnu.org>
0 siblings, 2 replies; 5+ messages in thread
From: W. Greenhouse @ 2013-02-20 16:39 UTC (permalink / raw)
To: info-gnus-english-mXXj517/zsQ
Hi Julien,
Julien Cubizolles <j.cubizolles@free.fr> writes:
> The subject says it all. I'm fetching news through emacs in batch mode
> in a cron job but I can't figure out how to get the possible errors
> through the mails sent by cron.
>
> In batch mode emacs output everything that should go to the *Messages*
> buffer to stderr so cron sends an email each time the job is run, even
> without any error. I don't want to receive an email when there is no
> problem. Is there a way to get emacs to send only the error messages to
> stderr ?
>
> Julien.
Yes, this should be a matter of shell redirection. Cron actually sends
both stdout and stderr to email, so if you only want stderr, then you
should redirect stdout to /dev/null. There isn't a -quiet option or
similar for Emacs in batch mode, so it's all up to the shell.
--
GnuPG/PGP key: subkeys.gnupg.net 0D2D3F9E
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gnus-agent-fetch in batch mode in a cron job
2013-02-20 16:39 ` W. Greenhouse
@ 2013-02-22 6:10 ` Julien Cubizolles
2013-02-22 6:32 ` W. Greenhouse
[not found] ` <mailman.20575.1361513992.855.info-gnus-english@gnu.org>
1 sibling, 1 reply; 5+ messages in thread
From: Julien Cubizolles @ 2013-02-22 6:10 UTC (permalink / raw)
To: info-gnus-english
wgreenhouse@riseup.net (W. Greenhouse)
writes:
> Hi Julien,
>
> Julien Cubizolles <j.cubizolles@free.fr> writes:
>
>> The subject says it all. I'm fetching news through emacs in batch mode
>> in a cron job but I can't figure out how to get the possible errors
>> through the mails sent by cron.
>>
>> In batch mode emacs output everything that should go to the *Messages*
>> buffer to stderr so cron sends an email each time the job is run, even
>> without any error. I don't want to receive an email when there is no
>> problem. Is there a way to get emacs to send only the error messages to
>> stderr ?
>>
>> Julien.
>
> Yes, this should be a matter of shell redirection. Cron actually sends
> both stdout and stderr to email, so if you only want stderr, then you
> should redirect stdout to /dev/null. There isn't a -quiet option or
> similar for Emacs in batch mode, so it's all up to the shell.
From what I understand Emacs outputs the whole *Messages* buffer to
stdout. So there is nothing the shell can do to sort error messages from
information messages. Is that right ?
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gnus-agent-fetch in batch mode in a cron job
2013-02-22 6:10 ` Julien Cubizolles
@ 2013-02-22 6:32 ` W. Greenhouse
0 siblings, 0 replies; 5+ messages in thread
From: W. Greenhouse @ 2013-02-22 6:32 UTC (permalink / raw)
To: info-gnus-english-mXXj517/zsQ
[-- Attachment #1.1: Type: text/plain, Size: 2126 bytes --]
Hi Julien,
Julien Cubizolles <j.cubizolles-GANU6spQydw@public.gmane.org> writes:
> From what I understand Emacs outputs the whole *Messages* buffer to
> stdout. So there is nothing the shell can do to sort error messages from
> information messages. Is that right ?
Hrm, you're not quite correct, but I'm not sure it actually matters.
From (info "(emacs) Initial Options"):
> `-batch'
> `--batch'
> Run Emacs in "batch mode". Batch mode is used for running
> programs written in Emacs Lisp from shell scripts, makefiles, and
> so on. To invoke a Lisp program, use the `-batch' option in
> conjunction with one or more of `-l', `-f' or `--eval' (*note
> Action Arguments::). *Note Command Example::, for an example.
> In batch mode, Emacs does not display the text being edited, and
> the standard terminal interrupt characters such as `C-z' and `C-c'
> have their usual effect. Emacs functions that normally print a
> message in the echo area will print to either the standard output
> stream (`stdout') or the standard error stream (`stderr') instead.
> (To be precise, functions like `prin1', `princ' and `print' print
> to `stdout', while `message' and `error' print to `stderr'.)
> Functions that normally read keyboard input from the minibuffer
> take their input from the terminal's standard input stream
> (`stdin') instead.
etc.
So which file descriptor emacs --batch sends printed output to does
actually depend on the function being called. And looking at the source
of gnus-agent, it does look like functions like `signal' and `error' are
consistently used as they should be, for actual network errors--which is
good. However, `message' is also used frequently, e.g. for the
"Checking new news..." in `gnus-group-check-new-news.' So it's not
guaranteed that stderr will only contain errors. So, you might actually
be better off either redirecting all output to /dev/null (as the example
in (info "(gnus) Batching Agents") does), or else redirect to a log
file.
--
Regards,
WGG
[-- Attachment #1.2: Type: application/pgp-signature, Size: 835 bytes --]
[-- Attachment #2: Type: text/plain, Size: 183 bytes --]
_______________________________________________
info-gnus-english mailing list
info-gnus-english-mXXj517/zsQ@public.gmane.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gnus-agent-fetch in batch mode in a cron job
[not found] ` <mailman.20575.1361513992.855.info-gnus-english@gnu.org>
@ 2013-08-01 12:48 ` Lars Magne Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 12:48 UTC (permalink / raw)
To: Julien Cubizolles; +Cc: info-gnus-english
Julien Cubizolles <j.cubizolles@free.fr> writes:
>>From what I understand Emacs outputs the whole *Messages* buffer to
> stdout. So there is nothing the shell can do to sort error messages from
> information messages. Is that right ?
I think that's correct.
--
(domestic pets only, the antidote for overdose, milk.)
No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-01 12:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-13 22:08 gnus-agent-fetch in batch mode in a cron job Julien Cubizolles
2013-02-20 16:39 ` W. Greenhouse
2013-02-22 6:10 ` Julien Cubizolles
2013-02-22 6:32 ` W. Greenhouse
[not found] ` <mailman.20575.1361513992.855.info-gnus-english@gnu.org>
2013-08-01 12:48 ` Lars Magne Ingebrigtsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).