How to run a script automatically ?????

Hi All,
How to run a script automatically using cronjob everyday from Monday to Friday 9A.M to 5P.M at an interval of ONE HOUR.I want the complete syntax means how to put in the cron job and there after.
URGENTLY NEED HELP
THANKS IN ADVANCE
CHEERS
Arunava

#Format is:
# MIN HOUR DAY MONTH DAY_OF_WEEK COMMAND
# where DAY_OF_WEEK is 0-6, 0=Sunday
0 9-17 * * 1-5 your_command

To enter the above data that PxT shared, you can type 'crontab -e' and edit the file. If it opens it in an unknown editor, set your EDITOR variable to vi or another editor. You can also put the entry in an arbitrary flat file and execute
crontab flat_file

Thanks for the reply .
So if i want to execute my file eith the name myfile.sh everyweekday at an interval of one hour from 9 a.m. to 5 p.m. will the command be
0 9-17 * * 1-5 myfile.sh
[ can we give a path here like /mydir/myfile.sh]
Also how do u put the entire thing using crontab command.
I will like to know the detail syntax.
Bye
Thanks in advance
Cheers
Arunava

The easiest way is to create a text file named /tmp/myfile.sh.cron (name and location are relative and do not matter) with your cron statement in it:

0 9-17 * * 1-5 /home/user/bin/myfile.sh

You should always put the full path to the file in the crontab and a shell script as your PATH variable may not be what you think it is. This entry will run the script as you described. Then logged in as the user you wish to run the program as, type:

crontab /tmp/myfile.sh.cron

You can the delete the myfile.sh.cron file. To verify that it read it in, type:

crontab -l

I am having problem when i am trying to execute my shell script .In the beginning of my script i am reading some parameter values from a parameter file. After that in this script i am calling an external sql script.
It gives an error message

grep: can't open parameter.txt
grep: can't open parameter.txt

Calling an external SQL script
/final/myscript.sh: mysql
.sh: not found

When i independently run my script there is no problem atall.

URGENTLY REQUIRE HELP

THANKS IN ADVANCE

Arunava

Sounds like maybe your script is not changing to the correct directory. Cron will 'cd' to your home directory before it runs your script. If you need to access files in other directories make sure to use full path names in your script, or else issue a 'cd' command.

The problem is i cannot hardcode my workpath in the scriptfile.So for this reason i have created a parameter file and i am taking all the values from that file.Now is it possible to write the cd command in the cronfile itself.

URGENTLY REQUIRE HELP

Thanks in advance

Regards
Arunava