i have made a script helloworld.sh
and its path is /home/ehimkak/cronTabTest
:
#/usr/bin/sh
echo $1
if [[ $1 = "cron" ]] ; then
echo "hiiiii"
else
echo "sorry"
fi
If I run it from the /
location with command
/home/ehimkak/cronTabTest/helloworld.sh cron
it runs fine.
Now I added a cron job by first setting the editor as vi (export EDITOR=vi) and then used command crontab -e
.
There I added a line
10,15,20,25,30,35,40,45,50,55 * * * * /home/ehimkak/cronTabTest/helloworld.sh cron>>/home/ehimkak/cronTabTest/t1.txt
The result is that the script is running, but the output is not as desired.
The output in the t1.txt file I get is
cron
sorry
but my output must come
cron
hiiii
There is no problem in the script, but i don't understand why crontab
is behaving in such a way.
Please help...