Skip to main content

Cron Basics

Cron is used to execute a script or command at a specified interval or point in time.   The control file is a crontab file (named crontab - with no extension).   A crontab file is made up of one line per entry.   An example crontab entry looks like this:

0 * * * * php $HOME/cron.php >>$HOME/cron.log 2>>$HOME/cron.err

In the above example, the script cron.php is executed every hour on the hour.

An entry line contains nine fields, which must be separated by white space (tabs or spaces).  The fields are:
  1. Minute of the hour in which to run (0-59)
  2. Hour of the day in which to run (0-23)
  3. Day of the month (0-31)
  4. Month of the year in which to run (1-12)
  5. Day of the week in which to run (0-6) (0=Sunday)
  6. Optional shebang, if needed (for running php scripts in the above example, may vary depending on your host config)
  7. The path/command to execute (note that $HOME gets you to your user root)
  8. The log file - which begins with >>
  9. The error log file - which begins with 2>>
An entry in the first five columns can consist of:
  • A number in the specified range
  • A range of numbers in the specified range; for example, 2-10
  • A comma-separated list consisting of individual numbers or ranges of numbers, as in 1,2,3-7,8
  • An asterisk that stands for all valid values
  • An asterisk with a /value, for example */10 in the minute location would mean very 10 minutes
  • Do not user tabs or spaces as they are the delimiters between columns
Some considerations are:
  • If you want to run a PHP script you should include the shebang (php in the above example)
  • If you want to pass variables to a PHP script the standard search argument syntax for passing $_GET variables will not work.  You can use the format path/script.php variable1=value variable2=value2 (note the arguments are simply separated by a space).
  • If you want to run a PHP script you should include the full UNIX path (i.e. $HOME/. . ./script.php ).  $HOME points to your FTP root directory.
  • The log files should include the full UNIX path
  • Your crontab must contain one blank line at the end
A line that begins with a # is treated as a comment line.

To create a crontab file:
  1. Create an empty text file (named crontab.txt) in Notepad
  2. Add the contents of your crontab file, you can have as many entry lines as you want
  3. Your crontab must contain one blank line at the end
  4. Upload the file to your package in the etc directory
  5. Rename the file crontab (with no extension)

Comments

Popular posts from this blog

links

0.  https://michael67654.qowap.com/64523001/new-pos-technique-to-perk-up-your-company 1.  https://johnnydinqr.blog2learn.com/52856602/new-pos-system-to-perk-up-your-company 2.  http://edwinsqgcu.onesmablog.com/New-POS-Process-to-Perk-Up-Your-company-43309737 3.  http://chloe69246.bloguetechno.com/New-POS-Process-to-Perk-Up-Your-Business-39814721 4.  http://jacob87541.pointblog.net/New-POS-Technique-to-Perk-Up-Your-online-business-43741223 5.  http://arlette53302.thezenweb.com/New-POS-System-to-Perk-Up-Your-online-business-41464611 6.  http://devinpixna.tinyblogging.com/New-POS-Program-to-Perk-Up-Your-online-business-46354577 7.  https://rylanevsom.blog5.net/46759651/new-pos-program-to-perk-up-your-small-business 8.  https://mariowoesh.affiliatblogger.com/56515206/new-pos-system-to-perk-up-your-organization 9.  https://liam66429.diowebhost.com/60164326/new-pos-procedure-to-perk-up-your-company 10.  https://henry19219.fitnell.com/4557...

Raisonnement, la résolution de problèmes

Les chercheurs ont d'abord développé des algorithmes mimétiques raisonnement humain étapes que les gens utilisent pour résoudre le casse-tête ou faire méthode d'exclusion logique. [2] Dans les années 1980 et 1990 fin, l'étude de la grippe aviaire a développé des méthodes de traitement de l'information incertaine ou incomplète, en utilisant des concepts de probabilité et de l'économie. [3] Pour ces problèmes, les algorithmes requis matériel assez puissant pour effectuer des calculs de géant - à subir « combinaisons d'explosion »: la quantité de mémoire et le temps de calcul peut devenir invisible prendre si la résolution d'un problème difficile. La plus haute priorité est l'algorithme de recherche pour résoudre le problème.  Les gens utilisent généralement les jugements rapides et intuitifs plutôt que pas de déduction que les chercheurs en IA d'origine peuvent simuler. [5] Amnesty International a progressé en utilisant la résolution de problèmes « c...

Tracking and Securing Downloads

If you want to report or track downloads from your website, try this script.   This script will send you an email every time you have a download.   The email will tell you what file was downloaded and who did the download.   You could change this script to keep counts (store them in flat file or MySQL) if you desire. The variable $directory is the directory where the download files are located.   If you want the script in the same directory as the files then use "./" as the directory (you must always have the slash). In your html page, use the following structure as your download link (where name.txt is the file name to download): <a href="download.php?file=name.txt">download</a> Then you use the following script (called download.php): - - Start Script Here - - <?php $emailaddress  =  "email@yourdomain.com" ; $filename  =  $_GET [ 'file' ]; $directory  =  "downloads/" ; $path  =  "$directory$filename" ; putenv (...