Re: Cron Jobs help needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ANY time you do anything 'scheduler' related you should always write to a log file then you 
can check that log file to determine what the problem is.

If the aforementioned line you supplied is EXACTLY what you have in cron, then it certainly 
will not function at all (man cron for proper format of cronfiles).  

If, however you are only showing us the command portion... then a previously supplied 
solution should correct your problem:

{path to php executable} {path to php script}  > {path to logfile} 2>&1

example:

/usr/bin/php $HOME/php/helloworld.php > $HOME/logs/helloworld.log 2>&1

Generally speaking you can use environment variables that are established by the system 
logon (e.g. $HOME) where appropriate.  Otherwise you should supply the full path to 
commands, unless you are sure the path to the command has been previously defuned by 
$PATH.  You also do not need to specify full paths to 'builtin' commands.  Builtins vary by 
operating system - try using 'man builtin' or 'man {shell} to obtain a list of builtin 
commands.  Best practice is to assume that NOTHING is define and supply full paths to 
everything.

Note the "2>&1" this means direct all std err (2>) output to the same location (&) as std 
out (1).  You could write a separate error file if you chose by doing something like this:

{command} > logfile 2> errfile

--- In php-objects@xxxxxxxxxxxxxxx, Reji Jayan <for_rejijayan@...> wrote:
>
> thanks for the mail abhishek,
> 
> my requirement is only o execute a file at regular intervals..
> 
> the file is to just to send a mail ... like a email notification 
> 
> Reji Jayan.




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux