Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
if [[ $Njour == JEUDI ]]
then
echo '====== backup JEUDI =========' >> /tmp/log.cron
else
echo '====== backup NON JEUDI =====' >> /tmp/log.cron
fi
my script work normaly with command line but it not works with unix cron
#ls -lrt test.sh
-rwx------ 1 root root 1760 apr 4 2008 test
#whoami
root
#crontab -l
If the file /tmp/crontab.log has been created, the crontab job has been executed (unless you have created it before). First, you can verify if the crontab works properly with a simple command, like this
Code:
00 11 * * * /bin/echo crontab test > /tmp/log.cron
Second, have you checked if root has received some mail from the cron daemon, before you added the redirection to crontab.log?
my crontab now is :
#crontab -l
00 11 * * * /home/test.sh
00 11 * * * /bin/echo 'crontab test' > /tmp/log.cron
firstly I deleted a file /tmp/log.cron for testing if the file log.cron is created or not ..
the result is : no file with name "log.cron" in /tmp directory
when I execute the scripts with command line the variable Njour is :
# Njour=$(date +%A|awk '{print toupper($1)}')
# echo $Njour
LUNDI
# echo $LANG
fr_FR.UTF-8
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.