From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Skulley, William" Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: Silly Cron/Script Questions Date: Tue, 04 Jun 2002 13:47:54 -0600 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <034FA6BC04A6754B8E16094B46E8960808DB3B@EXCHSRV3.rfets.gov> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: main.gmane.org 1023220108 11250 127.0.0.1 (4 Jun 2002 19:48:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 4 Jun 2002 19:48:28 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.20.101]) by main.gmane.org with smtp (Exim 3.33 #1 (Debian)) id 17FKI7-0002vL-00 for ; Tue, 04 Jun 2002 21:48:27 +0200 Original-Received: (qmail 14635 invoked by uid 5); 4 Jun 2002 19:48:02 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 14627 invoked from network); 4 Jun 2002 19:48:01 -0000 Original-Received: from unknown (HELO emroute2.cind.ornl.gov) (128.219.159.41) by 0 with SMTP; 4 Jun 2002 19:48:01 -0000 Original-Received: from emroute2.cind.ornl.gov (LOCALHOST [127.0.0.1]) by emroute2.cind.ornl.gov (PMDF V6.1-1 #39060) with ESMTP id <0GX700JLU5O1HT@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 04 Jun 2002 15:48:01 -0400 (EDT) Original-Received: from rfgate2-qfe0.rfets.gov (rfgate.rfets.gov [167.253.11.253]) by emroute2.cind.ornl.gov (PMDF V6.1-1 #39060) with SMTP id <0GX70017I5NXD7@emroute2.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Tue, 04 Jun 2002 15:47:58 -0400 (EDT) Original-Received: from [167.253.140.13] by rfgate2-qfe0.rfets.gov via smtpd (for emroute2.cind.ornl.gov [128.219.159.41]) with SMTP; Tue, 04 Jun 2002 19:47:57 +0000 (UT) Original-Received: by exchsrv2.rfets.gov with Internet Mail Service (5.5.2653.19) id ; Tue, 04 Jun 2002 13:47:57 -0600 Original-To: "'tru64-unix-managers@ornl.gov'" X-Mailer: Internet Mail Service (5.5.2653.19) Xref: main.gmane.org gmane.os.tru64.managers:436 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:436 Very fast response on this one, and yes, a simple answer, right out of the crontab man page: The cron program runs the command named in the sixth field at the specified date and time. If you include a percent sign (%) in the sixth field, cron treats everything that precedes it (in that field) as the command invoca- tion, and makes all that follows it available to standard input, unless you escape the percent sign (\%) or double quote it ("%"). Working entry is: 45 13 * * * script.ksh arg1 -arg2.`date +\%y\%m\%d` Thanks to Dr Blinn, Pat O'Brien, Martin Moore, Paul Sand, Ken Peacock, Dan Harrington and George Gallen. My apologies for asking a question so obviously documented. Bill > -----Original Message----- > From: Skulley, William [SMTP:William.Skulley@rfets.gov] > Sent: Tuesday, June 04, 2002 1:30 PM > To: tru64-unix-managers@ornl.gov > Subject: Silly Cron/Script Questions > > I have a cronjob: > > 0 0 * * * script.ksh arg1 arg2.`date +%y%m%d` > > arg2 is an output filename. When run from cron, the file comes out > "arg2." > with no date information tacked on. Running the exact same command line > from a shell (sh) prompt gets the date information properly (filename > arg2.020604). I get the following mail from cron: > > ************************************************* > Cron: The previous message is the standard output > and standard error of the following crontab command: > > script.ksh arg1 arg2.`date + > > > If I add double quotes and change the cron entry to: > > 0 0 * * * "script.ksh arg1 arg2.`date +%y%m%d`" > > the job does not run and I get the following mail from cron: > > sh: script.ksh arg1 arg2.: not found > > > ************************************************* > Cron: The previous message is the standard output > and standard error of the following crontab command: > > "script.ksh arg1 arg2.`date + > > > What am I missing? I'm sure its something really obvious and silly but I > can't for the life of me see it. > > Thanks > Bill Skulley