Crontab setting error

Hi All,

I have created crontab using following steps-

1) crontab -e

(edited the file with) 0 10 * * 1-5 /home/user01/exercise/cron.sh

2) then saved this file with :wq

3) cron.sh contains the code-

#!/bin/bash
DAY=`date +%a`
mkdir abc_${DAY}

4) done the execut permision for this file using-
chmod 777 cron.sh

I have checked this code from 2 days , its not going to create an directory for todays day, plase help me to solve this issue.I need to apply same concept in the project.How to do an an crontab setting , is there any mistake in above code?

Thanks in advance...

Most probably - script is trying to make directory somewhere, where it has no permissions to do that.
Try adding

cd /home/user01/exercise

before mkdir.
And change, just for test, cron time to

*/5 * * * *

, so You don't have to wait whole day to see if its working :slight_smile:

1 Like

but my problm is why it is not creating the directory , I have also tried which u have posted here. but its not giving me an output

---------- Post updated at 12:37 PM ---------- Previous update was at 12:30 PM ----------

Hey thanks its working now

need to add
cd /home/user01/exercise

Thanks a lot

this is working for me .. try this ..

#!/bin/bash
mkdir /your/home/path/testing_`date +%a`

Sample Cron entry..

13 * * * * sh /your/home/path/cron.sh 2>&1