cron and formated date command

From: Paul LaMadeleine (plamadeleine@lightbridge.com)
Date: Mon Jan 20 2003 - 12:54:48 EST


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



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:37 EDT