LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   why do these cronjob not run? (https://www.linuxquestions.org/questions/linux-general-1/why-do-these-cronjob-not-run-274348/)

SheldonPlankton 01-05-2005 05:46 PM

why do these cronjob not run?
 
Hi,

I use to be able to do stuff like this with Solaris is there some reason why these lines in my crontab don't work with RH9?
Code:

# blah blah
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=dog
MYts=`date +%Y%m%d%H%M`

# these do NOT run
* * * * * export MYts="XYZ" ;; echo $MYts > test_file_1
* * * * * MYts=`date` ;; export MYts ;; echo $MYts > test_file_2
* * * * * MYts=`date` ;; echo $MYts > test_file_2a
* * * * * echo "Hello" > test_file_`date +%H%M`

# this does run
* * * * * date > test_file_3


jailbait 01-05-2005 08:01 PM

export MYts="XYZ" ;; echo $MYts > test_file_1
should work OK.


Try picking up the date this way:
MYts=$(date)

Try changing:
echo "Hello" > test_file_`date +%H%M`
to:
echo "Hello" > test_file_$(date +'%H%M')


-----------------------------
Steve Stites


All times are GMT -5. The time now is 05:24 PM.