How can I run a command every ten minutes

I would like to run the following command every ten minutes, how can I do that ?

/usr/bin/php /home/phplist-3.5.4/public_html/lists/admin/index.php -pprocessqueue -c/home/phplist-3.5.4/public_html/lists/config/config.php

Just add the following to the end of the /etc/crontab file (see the format of the crontab file):

*/10    *    *    *    * root /usr/bin/php /home/phplist-3.5.4/public_html/lists/admin/index.php -pprocessqueue -c/home/phplist-3.5.4/public_html/lists/config/config.php

Note that it will run as root and you probably want to run as www-data instead for security reasons. And also to not create files owned by root that www-data won’t be able to modify or open.

FYI, i tried for ages with crontab -e but this way root is used, instead of www-data.
So you must edit /etc/crontab.

Here are my parameters to relaunch phplist queue processing every ten minutes and have the bounces checked and adressed every day at 3 AM:

# pour l'envoi des newsletters (relance du moteur toutes les 10 minutes)
*/10 *  * * *   www-data phplist -pprocessqueue > /dev/null 2>&1
# check et gestion des bounces à 3h du mat tous les jours
0 3     * * *   www-data phplist -pprocessbounces > /dev/null 2>&1
1 Like

And I forgot to mention that beforehand I added the following script in /usr/local/bin/ and named it phplist, following phplist doc:

#!/bin/bash
/usr/bin/php /home/website/public_html/lists/admin/index.php -c /home/website/public_html/lists/config/config.php $*

chmoded 755 and chowned to www-data too

1 Like