[lug] cron and date command

Bear Giles bgiles at coyotesong.com
Wed Mar 8 12:54:55 MST 2006


What shell is interpreting the command?  Are you sure it handles backticks?

I'm not saying this is the problem, but it's the type of thing that 
argues strongly for creating a script in /usr/local/bin and letting it 
handle things like subcommands.   I remember a discussion a while back 
regarding problems caused because cron was evaluating the commands with 
csh instead of sh for some reason.

Gordon Golding wrote:

>I want to run a backup script and feed it today's date.  I know I can change the script and be OK, but I'm wondering about this problem.
>I'm on Fedora Core 3.
>
>If I use `date +%y%m%d` it works fine from the command line.  But I run the same command in cron and it doesn't run - it doesn't create the log or err files or run the script.
>
>Neither of these 2 entries work. This example runs it hourly for testing. In the second example it doesn't work either as a parameter or part of the file name.
>
>0  *    *   *   *  BACKUPNAME=name`date +%y%m%d`
>0  *    *   *   *  /home/BACKUPS/Backup_to_Disk2.bsh name`date +%y%m%d` 1>/home/BACKUPS/name`date +%y%m%d`.log 2>/home/BACKUPS/name`date +%y%m%d`.err
>
>
>
>
>Gordon Golding
>aka Golding the Younger DH70
>gordongoldin at netscape.net
>http://cslr.colorado.edu/beginweb/cgi-bin/gen_page.php?user=goldingg&&group=STF
>303-494-5730
>"If Love is Blind, why is lingerie so popular?"
>
>
>__________________________________________________________________
>Switch to Netscape Internet Service.
>As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register
>
>Netscape. Just the Net You Need.
>
>New! Netscape Toolbar for Internet Explorer
>Search from anywhere on the Web and block those annoying pop-ups.
>Download now at http://channels.netscape.com/ns/search/install.jsp
>_______________________________________________
>Web Page:  http://lug.boulder.co.us
>Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>  
>




More information about the LUG mailing list