Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-13 Thread River Tarnell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

In article <4d57e888.7040...@surfeu.ch>,
Dr. Trigon  wrote:
> Makes sense and means I should redirect output from 'cronsub' to stdout
> (or maybe stderr) to have 'cronie' make mail this to me... ;)

That won't do anything, because cronsub doesn't produce any output 
(except in case of an error); it submits the job to SGE, then exits.  
The job output is handled by SGE, which writes it to the configured 
output file.

- river.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (NetBSD)

iEYEARECAAYFAk1X9fEACgkQIXd7fCuc5vJ3PwCfYVwdKM8saGU5pvZSaDs+99Hm
ba8AoLrBSPxpPyxomolsjYcO8KiJOdbN
=FCas
-END PGP SIGNATURE-

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-13 Thread Dr. Trigon
Makes sense and means I should redirect output from 'cronsub' to stdout
(or maybe stderr) to have 'cronie' make mail this to me... ;)

Greetings


Am 13.02.2011 01:33, schrieb River Tarnell:
> In article <4d56a4cd.6020...@surfeu.ch>,
> Dr. Trigon  wrote:
>> But I was wondering how SGE can replace such a common tool like CRON
>> without havin same functionallity... :)
> 
> Well, SGE does not replace cron.  SGE is an additional tool which is
> available to users; cron is not going away (indeed, cron is required to
> use SGE, except for one-shot jobs).
> 
> We would like all users to use SGE for their tools, which requires that
> everything which cron does on its own should *also* be possible, and
> easy, with SGE; otherwise users will not bother converting.  However,
> this is an ongoing process and is obviously not complete.
> 
>   - river.

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list:
https://wiki.toolserver.org/view/Mailing_list_etiquette



___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-12 Thread River Tarnell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

In article <4d56a4cd.6020...@surfeu.ch>,
Dr. Trigon  wrote:
> But I was wondering how SGE can replace such a common tool like CRON 
> without havin same functionallity... :)

Well, SGE does not replace cron.  SGE is an additional tool which is 
available to users; cron is not going away (indeed, cron is required to 
use SGE, except for one-shot jobs).

We would like all users to use SGE for their tools, which requires that 
everything which cron does on its own should *also* be possible, and 
easy, with SGE; otherwise users will not bother converting.  However, 
this is an ongoing process and is obviously not complete.

- river.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (NetBSD)

iEYEARECAAYFAk1XJp8ACgkQIXd7fCuc5vIq8wCfV0T+TfolyRsG99FEvJrWXce8
mAcAoKHn2Ln22VUgMj79xIm+UZ5ANZ9J
=iPMK
-END PGP SIGNATURE-

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-12 Thread Ilmari Karonen
On 02/13/2011 12:44 AM, Platonides wrote:
>
>> -j join
>>
>> Declares if the standard error stream of the job will be merged with the 
>> standard output stream of the job.
>>  An option argument value of oe directs that the two streams will be 
>> merged, intermixed, as standard output. An option argument value of eo 
>> directs that the two streams will be merged, intermixed, as standard error.
>>
>>  If the join argument is n or the option is not specified, the two 
>> streams will be two separate files.
>
> Note that you can pass the parameter to SGE inside the script, too.

Ah, yes, I'd seen that.  In fact, I'm using it.  What I don't recall 
seeing mentioned anywhere I looked was that things printed to stdout 
would be included in the job completion e-mail.

(In fact, even you didn't say so out right in your message, you just 
seemed to imply it.  And I haven't tested it, so I'm not going to swear 
it's even true.)

In fact, the man page would seem to imply that it isn't:

 > If the -o option is not specified, the default file name for the
 > standard output stream will be used.  The default name has the
 > following form:
 > job_name.osequence_number
 > where job_name is the name of the job, see -N option, and
 > sequence_number is the job number assigned when the job is submitted.

-- 
Ilmari Karonen

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-12 Thread Platonides
Dr. Trigon wrote:
> @Platonides:
> What is this parameter then??
> 
> Thanks and greetings
> DrTrigon

It's -j

> -j join
> 
> Declares if the standard error stream of the job will be merged with the 
> standard output stream of the job.
> An option argument value of oe directs that the two streams will be 
> merged, intermixed, as standard output. An option argument value of eo 
> directs that the two streams will be merged, intermixed, as standard error.
> 
> If the join argument is n or the option is not specified, the two streams 
> will be two separate files. 

Note that you can pass the parameter to SGE inside the script, too.


___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-12 Thread Jeremy Baron
Couldn't you just do `exec 2>&1` soon after the shebang line?

-Jeremy
On Feb 9, 2011 4:44 PM, "Platonides"  wrote:
> Ilmari Karonen wrote:
>> I remember being disappointed by the lack of stderr output in the mail I
>> got after switching my Commons MIME type statistics script over to SGE,
>> but then I just thought "meh, I'm logging to a file anyway, I can always
>> just look there if something goes wrong."
>
> SGE has a parameter to send stdout and stderr merged.
>
> ___
> Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
> https://lists.wikimedia.org/mailman/listinfo/toolserver-l
> Posting guidelines for this list:
https://wiki.toolserver.org/view/Mailing_list_etiquette
___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette

Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-12 Thread Dr. Trigon
First I have to thank you all very much for the numerous answers I got
to this question!! Some remarks from my side:


Am 09.02.2011 22:47, schrieb Platonides:
> Ilmari Karonen wrote:
>> I remember being disappointed by the lack of stderr output in the mail I
>> got after switching my Commons MIME type statistics script over to SGE,
>> but then I just thought "meh, I'm logging to a file anyway, I can always
>> just look there if something goes wrong."
>
> SGE has a parameter to send stdout and stderr merged.


@Ilmari Karonen:
This is more or less what I'm doing, in fact I use the wikimedia mailing
capabilities to send a mail to myself with any content (error messages,
tracebacks, ...) I want. But I was wondering how SGE can replace such a
common tool like CRON without havin same functionallity... :)

@Platonides:
What is this parameter then??

Thanks and greetings
DrTrigon


Am 09.02.2011 22:47, schrieb Platonides:
> Ilmari Karonen wrote:
>> I remember being disappointed by the lack of stderr output in the mail I 
>> got after switching my Commons MIME type statistics script over to SGE, 
>> but then I just thought "meh, I'm logging to a file anyway, I can always 
>> just look there if something goes wrong."
> 
> SGE has a parameter to send stdout and stderr merged.
> 
> ___
> Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
> https://lists.wikimedia.org/mailman/listinfo/toolserver-l
> Posting guidelines for this list: 
> https://wiki.toolserver.org/view/Mailing_list_etiquette
> 


___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-09 Thread Platonides
Ilmari Karonen wrote:
> I remember being disappointed by the lack of stderr output in the mail I 
> got after switching my Commons MIME type statistics script over to SGE, 
> but then I just thought "meh, I'm logging to a file anyway, I can always 
> just look there if something goes wrong."

SGE has a parameter to send stdout and stderr merged.

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-09 Thread Andre Koopal
On Wed, Feb 09, 2011 at 01:22:30AM +, River Tarnell wrote:
> 
> Or only if the command generated output:
> 
>   #! /bin/ksh
>   f=$(mktemp)
>   trap "rm -f $f" 0
>   /path/to/mytool >$f 2>&1
>   test -s $f && <$f mailx -s "Tool output" $LOGNAME
> 
If you only want to get mail when there is output, you can simply do:

/path/to/mytool | 2>&1 mail -e -s "Tool output" $LOGNAME

the -e will tell mail to suppress sending mail when stdin is empty.

Regards,

Andre

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-09 Thread River Tarnell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

In article <4d529b28.7030...@vyznev.net>,
Ilmari Karonen   wrote:
> On 02/09/2011 03:22 AM, River Tarnell wrote:
> > Or, if you only wanted to receive output on failure:
> >
> > #! /bin/ksh
> > f=$(mktemp)
> > trap "rm -f $f" 0
> > /path/to/mytool>$f 2>&1 ||<$f mailx -s "Tool output" $LOGNAME
 
> Just out of curiosity... is there a particular reason for the -f switch 
> to rm here, or are you just trying to be extra sure the tempfile gets 
> deleted?

Because:

* Without -f, rm behaves differently depending on whether the script is 
  run from an interactive terminal or not, so I always use -f to get 
  consistent behaviour; and

* It doesn't matter if the file was already deleted, so I don't want an 
  error message if rm fails.

- river.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (NetBSD)

iEYEARECAAYFAk1S++cACgkQIXd7fCuc5vLkOwCfUbDGfLxRJioXM2mVfX3dCqka
pXsAn29jjiirj4GmFAWQ5+PaIA92jrG5
=Ufaq
-END PGP SIGNATURE-

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-09 Thread Ilmari Karonen
On 02/09/2011 03:22 AM, River Tarnell wrote:
>
> Or, if you only wanted to receive output on failure:
>
>   #! /bin/ksh
>   f=$(mktemp)
>   trap "rm -f $f" 0
>   /path/to/mytool>$f 2>&1 ||<$f mailx -s "Tool output" $LOGNAME

Just out of curiosity... is there a particular reason for the -f switch 
to rm here, or are you just trying to be extra sure the tempfile gets 
deleted?

> I think you're the first person who's asked about this, but it seems
> like a useful feature, so I'll see if there's a way to make it easier.

I remember being disappointed by the lack of stderr output in the mail I 
got after switching my Commons MIME type statistics script over to SGE, 
but then I just thought "meh, I'm logging to a file anyway, I can always 
just look there if something goes wrong."

-- 
Ilmari Karonen

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-08 Thread River Tarnell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

In article <4d516a08.5050...@surfeu.ch>,
Dr. Trigon  wrote:
> Just a short question in [1] is mentioned how to trigger a mail in case
> 
> * the job starts
> * the job finishes
> 
> what about
> 
> * the job print something to stdout like for CRON jobs (in the early
>   days... ;))

I don't think there's a built-in method of doing this.  You could use a 
wrapper script that did something like:

#! /bin/ksh
/path/to/mytool 2>&1 | mailx -s "Tool output" $LOGNAME

Or, if you only wanted to receive output on failure:

#! /bin/ksh
f=$(mktemp)
trap "rm -f $f" 0
/path/to/mytool >$f 2>&1 || <$f mailx -s "Tool output" $LOGNAME

Or only if the command generated output:

#! /bin/ksh
f=$(mktemp)
trap "rm -f $f" 0
/path/to/mytool >$f 2>&1
test -s $f && <$f mailx -s "Tool output" $LOGNAME

... etc.

I think you're the first person who's asked about this, but it seems 
like a useful feature, so I'll see if there's a way to make it easier.

- river.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk1R7FIACgkQIXd7fCuc5vKEPgCdEJj19ST9Kmz1jknYCtFSo09x
iH0AnRMSq1OPN4N+20/8MtsaxmjgO8Ac
=3lS2
-END PGP SIGNATURE-

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette


Re: [Toolserver-l] Job scheduling and mail receiving

2011-02-08 Thread Paul Selitskas
The output of tools which write direct-to-stdout should be sent to you
by e-mail to your toolserver e-mail. If you set an adress to relay the
mailings to, then you'll get cron jobs output there. Works for me,
though.

Although, this ain't work from scratch for cronsubbed tools.

On Tue, Feb 8, 2011 at 6:06 PM, Dr. Trigon  wrote:
> Hello all
>
> Just a short question in [1] is mentioned how to trigger a mail in case
>
> * the job starts
> * the job finishes
>
> what about
>
> * the job print something to stdout like for CRON jobs (in the early
>  days... ;))
>
> Thanks a lot for answering
> Greetings
> Dr. Trigon
>
> [1]
> https://wiki.toolserver.org/view/Job_scheduling#Receiving_mail_when_the_job_starts_or_finishes
>
> ___
> Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
> https://lists.wikimedia.org/mailman/listinfo/toolserver-l
> Posting guidelines for this list: 
> https://wiki.toolserver.org/view/Mailing_list_etiquette
>



-- 
З павагай,
Павел Селіцкас/Paul Selitskas
Wizardist @ Wikimedia projects
p.selits...@gmail.com, +375257408304
Skype: p.selitskas

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette

[Toolserver-l] Job scheduling and mail receiving

2011-02-08 Thread Dr. Trigon
Hello all

Just a short question in [1] is mentioned how to trigger a mail in case

* the job starts
* the job finishes

what about

* the job print something to stdout like for CRON jobs (in the early
  days... ;))

Thanks a lot for answering
Greetings
Dr. Trigon

[1]
https://wiki.toolserver.org/view/Job_scheduling#Receiving_mail_when_the_job_starts_or_finishes

___
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette