I do this all the time, but what I do is the following:

# twords beginning of file
export DATE=`date +%Y%m%d`

# where I want to call the variable

tar cvf /backup/$DATE.tar /appl /home/samba



On Thu, 7 Mar 2002, Eric Sisler wrote:

> 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
>

-- 
Arthur H. Johnson II
[EMAIL PROTECTED]
The Linux Box
http://www.linuxbox.nu
Office:  1-734-761-4689
Pager:   1-734-882-0323



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

Reply via email to