Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> So You Wanna Learn Crons Huh?
OpaQue
post Jan 27 2005, 03:50 AM
Post #1


Administrator
Group Icon

Group: Admin
Posts: 1,482
Joined: 11-June 04
From: Somewhere in Time & Space.
Member No.: 1



Ok. Many people are yelling that they cannot configure the crons properly.

Here is a short tutorial by "me" which will help you set them

Basically you will want to run a PHP script file in specific intervals. Suppose you want to execute a php file called maintanence.php every one hour. This is what you do

[ This tutorial is for noobs, Dont go into detail. Just do as instructed ]

The CRON Command is in the Following Format

[ Minute - Hour - Day - Month - Weekday ] - Command

The COMMAND, can be broken down in
[PATH OF PHP] [ARGUMENTS] [PATH OF PHP SCRIPT]

So the COMPLETE CRON command can be written as

[ Minute - Hour - Day - Month - Weekday ] [PATH OF PHP] [ARGUMENTS] [PATH OF PHP SCRIPT]

The timing is spedified using * symbols

* * * * * => Execute every minute
0 * * * * => Execute every Hour
0 0 * * * => Execute every mid-night
0 0 0 * * => Execute every Month
0 0 0 0 * => Execute every Weekday

If you did not understand anything till now.. Good, this means you are a noob.. Read ahead tongue.gif

Since this is a UNIX command, You will have to Mention the PATH of PHP. At trap17, it is : /usr/local/bin/php

These are the Possible Command line Arguments you can use. This will effect the output. In our case, we will use the -q ( Quiet mode ) argument.
CODE

 -a               Run interactively
 -b <address:port>|<port> Bind Path for external FASTCGI Server mode
 -C               Do not chdir to the script's directory
 -c <path>|<file> Look for php.ini file in this directory
 -n               No php.ini file will be used
 -d foo[=bar]     Define INI entry foo with value 'bar'
 -e               Generate extended information for debugger/profiler
 -f <file>        Parse <file>.  Implies `-q'
 -h               This help
 -i               PHP information
 -l               Syntax check only (lint)
 -m               Show compiled in modules
 -q               Quiet-mode.  Suppress HTTP Header output.
 -s               Display colour syntax highlighted source.
 -v               Version number
 -w               Display source with stripped comments and whitespace.
 -z <file>        Load Zend extension <file>.


The Path of the PHP file Must be Complete absolute path.
If you have an Account at TRAP, And your USERNAME is "tom", Your path will be
"/home/tom/public_html/"

I assume you are familier with the PUBLIC_HTML directory. That is the Root folder where you store your html files.

So lets say that Tom wants to execute my script "maintenance.php" every hour. And it is stored in "public_html/cron/maintenance.php";

So the Complete CRON command would be,

CODE
0 * * * * /usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php


If tom wants to execute it every minute, he would use.

CODE
0 0 * * * /usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php


There are more Complex forms of Assigning the TIMINGS for these scripts. You can go to CPANEL => Cron Jobs => Standard and set exact time when the script will be executed.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Taking The Linux Plunge(10)
  2. Tutorial On How To Compile Your Own Mangos World Of Warcraft Private Server.(4)
  3. Learn Html Quick And Easy(15)
  4. Signature Tutorial(27)
  5. Where/how Did You Learn Css?(39)
  6. Should Children Learn "both" Theories?(28)
  7. Learn To Appreciate Others!(5)
  8. where did you learn html from?(89)
  9. Free 10 Day Affiliate Masters E-course(0)
  10. Disabling Safe Boot On Windows Xp(3)
  11. Whats You Current Trick You Want To Learn?(10)
  12. Asian Food Recipes(4)
  13. Team Fortress 2 Professional Spy Guide(3)
  14. Learn Java Programming Language Online Step By Step(1)
  15. Java Mobile Applications(7)
  1. Does Anyone Here Take Cholestorol Medication?(17)
  2. Learn To Fly(13)
  3. A Prelude To Programming(10)
  4. Cool Site To Learn Languages(6)
  5. Wanting To Touch Up/learn My Html Again(27)
  6. Where Is There A Good Site To Learn Web Html?(20)
  7. Perl Regular Expresions Regex(2)
  8. Learn Html, Css, C And C++ Online For Free(12)
  9. What Was Your First Computer, And How Did You Learn To Use It?(44)
  10. wanna know the gender of people on ere!!(20)
  11. How Can I Learn Assembly(14)
  12. Make Money From Wap Sites(8)
  13. History Of Eu Countries - What Shall Kids Learn In School?(9)
  14. Cod Clan(13)
  15. Learn Russian(7)


 



- Lo-Fi Version Time is now: 16th October 2008 - 04:05 AM