Summary: cron and formated date command

From: Paul LaMadeleine <plamadeleine_at_lightbridge.com>
Date: Tue Jan 21 2003 - 12:12:23 EST
Thanks for all the responses (and those still to come...),

         Most people replied with put it in a script.  While this is 
normally what I do, there are times that it's just easier/faster/better to 
do it this way (scripts wrapping scripts wrapping scripts etc, lots of 
small scripts files in sub dirs, etc.).  Anyway, this method works.

         Peter Hackett supplied me with the solution:

>Ditch the single quotes and escape the spaces as well, like so:
>
>mailx -s "testing `date +\%a\ \%b\ \%d`" plamadeleine@lightbridge.com
>
>HAGO!

         This worked perfect.

         Thanks for all the input.

         Paul

At 12:54 PM 1/20/2003 -0500, Paul LaMadeleine wrote:
>Greetings,
>
>          I'm probably over looking something simple, but it's monday and
>I've been hitting my head against the keyboard for over an hour on this one...
>
>          This is on a Solaris 8 system.
>
>          I'm trying to use a formatted output from date in the subject line
>of a mailx from cron.  Basicly, I've got the following two lines in my 
>crontab:
>
> >50 12 * * * echo "test" | mailx -s "testing `date +'\%a \%b \%d'`"
> >plamadeleine@lightbridge.com
> >50 12 * * * echo "test" | mailx -s "testing `date +'%a %b %d'`"
> >plamadeleine@lightbridge.com
>
>          This first one sends mail, but the '\' is in the subject line:
>
> >Date: Mon, 20 Jan 2003 12:50:00 -0500 (EST)
> >From: Super-User <root@lightbridge.com>
> >To: plamadeleine@lightbridge.com
> >Subject: testing \Mon \Jan \20
> >
> >test
>
>          The second does not send any mail, but cron sends this email:
>
> >root@pcfraud:/var/log% mail
> > From root Mon Jan 20 12:50:00 2003
> >Date: Mon, 20 Jan 2003 12:50:00 -0500 (EST)
> >From: Super-User <root>
> >Message-Id: <200301201750.h0KHo0R02325@pcfraud.lightbridge.com>
> >To: root
> >Subject: Output from "cron" command
> >Content-Length: 245
> >
> >Your "cron" job on pcfraud
> >echo "test" | mailx -s "testing `date +'
> >
> >produced the following output:
> >
> >The flags you gave are used only when sending mail.
> >Usage: mailx -eiIUdFntBNHvV~ -T FILE -u USER -h hops -r address
> >                 -s SUBJECT -f FILE users
> >
> >
> >?
>
>
>          Any ideas?
>
>          Thanks,
>
>          Paul
>_______________________________________________
>sunmanagers mailing list
>sunmanagers@sunmanagers.org
>http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Tue Jan 21 12:16:36 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:02 EST