Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cron Jobs...newbie here 1

Status
Not open for further replies.

peacecodotnet

Programmer
May 17, 2004
123
US
OK, I'm not particularly good with UNIX. In fact, I know nothing about it. However, I have a web site that is growing fairly fast, and I want to use CRON jobs to do stuff. I guess I have two main questions:

--Do you have to put the files that you want the cron to do in a certain place? When I first did it, I just put in a file name and put that file right on my server. When it tried to execute I got a message that looked like this:
/bin/sh: line 1: ip.php: command not found
ip.php is the address that I put in for it to execute...which leads me to my next question:

--Do you have to make a certain kind of file for it to execute? Can it be a PHP file, or does it have to be something weird?


Thank you to anyone who can help me.

Peace out,
Peace Co.
 
keyword search for cron/crontab and you'll get lots of good tips and hints.... :)
 

I would like to see the cron entry you have, but you probably need to put the whole path to ip.php in your cron command:

00 00 * * * /path/to/ip.php

There is a fundamental difference between running a command under cron, and running a command directly.

Firstly, the command is run under the base bourne shell /bin/sh, and does not source the users profile when the command is executed.

This means that if the profile (environment) of the user is setup to be able to run the command, that environment will not be in effect unless you add the following to your cron command:

00 00 * * * . ./.profile; /path/to/ip.php

Try both of these and write back if you dont have any success. When you write back, include the line you have entered in cron and an example of the script you are trying to run.

Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top