Setting up your Cron: manual chapter feedback and discussion

Feedback on the following chapter: https://www.phplist.org/manual/ch036_setting-up-your-cron.xhtml

The example also discards any output, which you will want to do. You can
always check the output by running the above commands manually from the
shell-prompt.

I recommend capturing the output to help diagnose any problems. On shared hosting systems people do not usually have access to the command line.
I suggest changing the command to capture the output in a file in the home directory:

*/5 * * * * phplist -pprocessqueue > ~/processqueue.log 2>&1

A minor comment on the use of the phrases “the cron” or “a cron”.
I think that the usual term is “a cron job”.

Caveats

The method described in this chapter requires the CLI version of
PHP. This may not be available on all systems. There are some “hacks”
to make it work with other versions of PHP, but this is non-intentional
functionality and therefore not described here.

The reference to requiring php-cli is now not the case. Since (I think) phplist 3.0.9 phplist detects whether it is being run from a command line/cron job as opposed to through a web server even for php-cgi.

1 Like

great feedback :slight_smile: Do you think you can correct that? http://booki.flossmanuals.net/phplist/_edit/ - would be helpful if you can, if not, I will add it to the list :slight_smile:

Also it shouldn’t be forgotten that the script to be cronned should have execution permissions set:

sudo chmod +x /usr/bin/phplist

@allvoxman Isn’t that system-specific? The included command chmod 755 /usr/local/bin/phplist was not sufficient in your case?

I would say yes, but it wasn’t really my case. But maybe I assigned it to the wrong user, I don’t know. The log descripted by @duncanc surely showed permission errors. Once I run that command as root, it started working.

@allvoxman Thanks for the clarification. Based on this the manual page will not be updated for now.

1 Like

My cron was working, but has stopped, i have tried resetting it up by following the instructions and am getting

Task “phplist -pprocessqueue” completed with error in 0 seconds, output:
/bin/sh: phplist: command not found

I’m on plesk onyx, centos on a vps with php 7

Hi there,

hiding links for processing queues and bounces will hide them for Super Admins too?

Thanks,
Filippo

For the bash script on this documentation page, using a variable for the path to the root of the site would make the code easier to read and customize. Something like:

#!/bin/bash
# No trailing slash on the following path
PATH_TO_ROOT=/home/website/public_html
/usr/bin/php $PATH_TO_ROOT/lists/admin/index.php -c $PATH_TO_ROOT/lists/config/config.php $*
1 Like

It seems that (with sme server configurations at least) the full path to phplist cli must be specified in the crontab like
*/5 * * * * /usr/local/bin/phplist -pprocessqueue >> /var/log/processqueue.log 2>&1

Thanks to azertyker this insight

3 Likes

I find I need to specify the full path like this on CentOS 7. It was a bit of a head scratcher I must say.

Could we add a note about this to the manual page?

Thanks!

1 Like

Yes, the manual can be edited by cloning the repository and making a pull request : https://github.com/phpList/phplist-manual

Is that possible for you?

Yes it is!

PR created. :thinking:

Thanks! PR now merged. Should be online shortly (it deploys automatically from the github repo).