actually its the % that crond is interpreting as newline. use
/usr/local/sbin/backup.bash "`date +\%Y-\%m-\%d`" Fri

steve

-----Original Message-----
From: Eric Sisler [mailto:[EMAIL PROTECTED]]
Sent: 07 March 2002 15:51
To: [EMAIL PROTECTED]
Subject: Using the date command in a crontab entry


Greetings,

I'm trying to insert the date command in a crontab entry, and I keep 
getting an error.  I've tried just about every possible syntax I can think 
of, so I'm either being stupid or what I want can't be done.  I've tried 
the following entries (minus the time/date/day fields):

/usr/local/sbin/backup.bash "`date +%Y-%m-%d`" Fri
-or-
/usr/local/sbin/backup.bash "`date '+%Y-%m-%d'`" Fri
-or-
/usr/local/sbin/backup.bash `date +%Y-%m-%d` Fri
-or-
/usr/local/sbin/backup.bash `date '+%Y-%m-%d'` Fri

This *shoud* pass two arguments to the script backup.bash, making the 
command look like so:

/usr/local/sbin/backup.bash 2002-03-07 Fri

but cron doesn't like the date command.  I'm thinking that it's tripping 
over the "+" needed to format the date command since e-mail from cron reads:

Subject: Cron <root@feathers> /usr/local/sbin/backup.bash `date +

/bin/sh: -c: line 1: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 2: syntax error: unexpected end of file

I know I can use a short perl script to pass the date along, but I was 
trying to just do so in the cron entry.  Am I doing something wrong or do I 
need to use a short perl "wrapper" script?

-Eric


Eric Sisler
Applications Specialist
Westminster Public Library
Westminster, CO USA

Linux - Don't fear the Penguin.
Want to know what we use Linux for?
Visit http://gromit.westminster.lib.co.us/linux



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to