larger smaller normal text version of this page

Revision [1976]

Last edited on 2009-05-26 22:09:05 by AlStillero
Additions:
See also: [[http://forums.phplist.com/viewtopic.php?f=6&t=11712 How to get phplist working with cpanel cron]]
==Useful forum threads==
- [[http://forums.phplist.com/viewtopic.php?f=6&t=24643 Tutorial - crontab queue processing with php-cgi]]
- [[http://forums.phplist.com/viewtopic.php?f=16&t=2232 how to make phpList work with Cron Jobs]]


Revision [889]

Edited on 2006-10-22 03:55:24 by AlStillero [some edits]
Additions:
Some hosting providers offer the possibility to setup a cron job using the Cpanel site interface. Please consult their Cpanel tutorial or help pages for information on how to go about this. Alternatively, you should be able to find such a tutorial by searching the Internet.
Some hosting providers do not allow users to install a cron job on the server. Instead they require you send them a copy of the crontab file you want to execute, and will then install it for you.
If you're in doubt which of the above methods you can or should use, please contact your ISP.
Deletions:
//This page describes how to setup a Cron job. For the moment it only provides an description of the 'Unix style' procedure. The Cpanel procedure should be appended later on. //
A description of the procedure for CPanel needs to be added. For the moment you could search the forum for 'cpanel cron job'
Some hosting providers do not allow users to install a cron job on the server. Instead they require you send them a copy of the cron job you want to execute, and will than install it for you. If you're in doubt which method you can or should use, please contact your ISP.


Revision [862]

Edited on 2006-10-20 05:36:08 by AlStillero [Added link to Cron job examples page]
Additions:
- [[CronJobExamples Cron job examples]]


Revision [860]

Edited on 2006-10-20 05:27:09 by AlStillero [minor edits]
Additions:
* The asterisk ('*') operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to 'every hour'.
* The slash ('/') is an operator -available with some extended versions of cron support- which can be used to skip a given number of values.
17 0 * * * /usr/bin/php /home/mydomain/public_html/lists/admin/index.php -pprocessqueue -c/home/mydomain/public_html/lists/config/config.php >/dev/null
Deletions:
* The asterisk ('*') operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to 'every hour'..
17 0 * * * /usr/bin/php /home/mydomain/public_html/lists/admin/index.php -pprocessqueue -c/home/mydomain/public_html/lists/config/config.php


Revision [855]

Edited on 2006-10-20 02:08:56 by AlStillero [minor edits]
Additions:
===Format of a crontab file===
Each line of a crontab file has a fixed scheduling format and executes one particular command. The crontab scheduling format is summarized in this scheme:
%%(php)
# MY CRON JOB FOR PHP-CLI
The following text is for Unix/Linux server with access to the command line (SSH access is necessary). To get additional information on managing cron jobs type '''man crontab''' and to get information about the format of the crontab file type '''man 5 crontab'''.
To load and activate your new/merged crontab.txt file you have to execute '''crontab crontab.txt''' at the command line. Finally, check the result with calling again '''crontab -l'''.
//Note: this description is based on an excellent forum post by Jochen (jotazzu).//
- [[PhpListConfigSendRate Setting the send speed]]
Deletions:
===Format and syntax crontab file===
Each line of a crontab file has fixed scheduling format and executes one particular command. The crontab scheduling format is summarized in this scheme:
==Operators==
# MY CRON JOB
The following text is for Unix/Linux server with access to the command line (SSH access is necessary). To get additional information on managing cron jobs type 'man crontab' and to get information about the format of the crontab file type '''man 5 crontab'''.
To load and activate your new/merged crontab.txt file you have to execute '''crontab crontab.txt''' at the command line. Finally, check the result with calling again '''crontab -l'''.


Revision [852]

Edited on 2006-10-19 04:49:47 by AlStillero [Preparation of this page and first draft]
Additions:
==[[PhplistDocumentation Phplist Documentation]] » [[MessageFunctionsInfo Message functions]] » [[ProcessQueueInfo Process the message queue]] » ==
====Setting up a Cron job====
//This page describes how to setup a Cron job. For the moment it only provides an description of the 'Unix style' procedure. The Cpanel procedure should be appended later on. //
===What is a Cron Job===

A cron job is a scheduler -commonly used in Unix-like operating systems- to periodically execute commands. These commands are read from a file, which is usually referred to as a 'crontab file'. This crontab file will be checked each minute to see if any scheduled commands need to be executed. For more info see [[http://en.wikipedia.org/wiki/Crontab Wikipedia: crontab]]


===Format and syntax crontab file===

Each line of a crontab file has fixed scheduling format and executes one particular command. The crontab scheduling format is summarized in this scheme:

%%
# (Use to post in the top of your crontab)
# ------------- minute (0 - 59)
# | ----------- hour (0 - 23)
# | | --------- day of month (1 - 31)
# | | | ------- month (1 - 12)
# | | | | ----- day of week (0 - 6) (Sunday=0)
# | | | | |
# * * * * * command to be executed
%%

==Operators==
You can use several operators for specifying scheduling values. These are the ones commonly used:
* The comma (',') operator specifies a list of values, for example: "1,3,4,7,8"
* The dash ('-') operator specifies a range of values, for example: "1-6", which is equivalent to "1,2,3,4,5,6"
* The asterisk ('*') operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to 'every hour'..

//**Example of a crontab file**//:

%%
#=================================================================
# MY CRON JOB
# crontab for processing all messages with status 'queued' with PHP-cli
# - MAILQUEUE_BATCH_SIZE=0 is recommended.
# - Setting the MAILQUEUE_THROTTLE may be needed to avoid overloading the server.
# All emails will be sent in one run. Processing starts at 17 min after midnight and continues
# as long as subscribers have to be processed. This may take many hours with large lists.
# Setting up multiple entries at different hours will repeat the process queue command multiple
# times a day.
# Make sure that enough time has passed and that the previous job has finished
# before scheduling the next.
#=================================================================
17 0 * * * /usr/bin/php /home/mydomain/public_html/lists/admin/index.php -pprocessqueue -c/home/mydomain/public_html/lists/config/config.php

%%


===How to setup a Cron job===

==Using the Unix/Linux command line==
The following text is for Unix/Linux server with access to the command line (SSH access is necessary). To get additional information on managing cron jobs type 'man crontab' and to get information about the format of the crontab file type '''man 5 crontab'''.

First you should check if there are still jobs running for the current user. This is done by typing '''crontab -l'''. If there are, you should save them in a file at which you may append your own jobs. The command is '''crontab -l >crontab.txt'''. The name of the file is free. Usually it is called crontab without any extension. Avoid placing the file in the DOCUMENT_ROOT folder branch of your web server (this is only for security). If no existing scheduled jobs are found, you can create an empty file with the command '''touch crontab.txt'''.

If you use an editor on Unix, open that file for editing. If you prefer editing the file on your local computer, download the file and edit it locally. Set the scheduled times as described in '''man 5 crontab''' and append on the same line the command you want to execute. At the end of the crontab file, add a new line. This avoids an end-of-file on the last schedule. Save/Upload the file. If you are working locally on Windows or Mac be aware to convert the line breaks into the Unix format. Most FTP programs can do this automatically, you just have to ensure that they are properly configured.

To load and activate your new/merged crontab.txt file you have to execute '''crontab crontab.txt''' at the command line. Finally, check the result with calling again '''crontab -l'''.

==Using Cpanel==
A description of the procedure for CPanel needs to be added. For the moment you could search the forum for 'cpanel cron job'

==Using your ISP==
Some hosting providers do not allow users to install a cron job on the server. Instead they require you send them a copy of the cron job you want to execute, and will than install it for you. If you're in doubt which method you can or should use, please contact your ISP.



==Related pages==
- [[MessageFunctionsInfo Message functions]]
- [[ProcessQueueInfo Process the message queue]]
Deletions:
[[PhplistDocumentation Phplist Documentation]]
=====Title of the page =====
//This page is a **template** intended for documentation of **official phplist features**. This page belongs to CategoryTemplate (which contains more handy templates). To create a phplist **documentation** page, [[http://docs.phplist.com/DocumentationTemplate/clone clone this page]], replace the title with a meaningful one and replace this paragraph with the actual page content.//


Revision [851]

The oldest known version of this page was created on 2006-10-19 02:14:20 by AlStillero [Setting up a Cron job]
Page was generated in 0.0663 seconds