Setting up processing automation

Now that we are able to manually send messages and process bounces, it would be handy to be able to automate these actions so that they happen at regular intervals.

Requirements

The requirements are as follows:

  • Access to Cron—for automatic phpList processing, we'll need access to schedule jobs on our server using cron entries. Your provider may have made this available using a control panel and it may be called something like "scheduled tasks", or "automated tasks".
  • Filesystem information—we'll also need to know the filesystem path to our phpList installation, the user our scripts will run as and (potentially) the path to the PHP binary. It will also be helpful to have shell (SSH) access to our host.

Customize the CLI "wrapper"

Before we can use the scheduling tools to set up automated phpList processing, we need to customize the "wrapper" bash shell which we can run on our host, that'll do the CLI-based phpList work.

phpList's source code includes a bin subfolder containing a file called phplist (this file will be set as executable if you unpacked the phpList source on a POSIX-based host).

Copy the bin directory to a location outside of your publicly-accessible phpList files (that is, at the same level in the directory hierarchy as your public_html folder or the folder where all your web-accessible files are).

Edit the phplist file inside the bin directory.

You will need to customize the following lines to suit your installation:

CONFIG=/home/website/public_html/lists/config/config.php

Change this to reflect the filesystem path to your phpList installation:

/usr/bin/php /home/website/public_html/lists/admin/index.php $*

Change this to reflect both the filesystem path (again) and the PHP binary location on our host (/usr/bin/php may well be correct).

Having updated the bin/phplist file, open your config/config.php file and look for the line containing commandline_users:

$commandline_users = array("admin");

Edit this line by replacing admin with the user under which your web host processes run as.

Note

This username might be difficult to determine, especially in a shared environment. If you can access a shell session, run the whoami command to determine this. If you are using a dedicated server, this will be the user under which your web server runs. Your web hosting provider can supply you with this information.

Now that you have prepared phpList's config and your wrapper script, use whatever interface you have at your disposal to schedule tasks as follows:

Process bounces: /path/to/bin/phplist p processbounces
Process queue : /path/to/bin/phplist p processqueue
Process RSS : /path/to/bin/phplist p processrss

Note

Don't worry about running the processqueue task too frequently—if it runs and detects that it's been run in the past six minutes, it'll abort with a warning so you can't cause multiple copies to run simultaneously.

The author recommends you to run the processqueue action every 30 minutes and the processbounces and processrss every day.

Tip

Getting RSS before processing queue

If you have a regular, repeating RSS message scheduled for sending in your queue, it's a good idea to make sure that the processrss task runs before this message is scheduled to be sent. That way, the latest RSS items will be included in the message.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.104.230