Validating Crontab Entries with PHP

Who said regular expressions can’t do that? Courtesy of my employer, Salir.com, here’s a PHPUnit test which does such validation. Feel free to modify & distribute. I’ll appreciate if you keep the @author notice & link to web site. <?php /** * @author Jordi Salvat i Alabart – with thanks to <a href=”www.salir.com”>Salir.com</a>. */ abstract … Read more

Why is crontab not executing my PHP script?

Given */30 * * * * php /var/www/html/result.php There are multiple possibilities why it is not working: First of all it is important to check if the simple execution of php /var/www/html/result.php. This is required. But unfortunately, accomplishing this does not mean that the problem is solved. The path of the php binary has to … Read more

Executing php with crontab

Start by typing at a command line: whereis php Do this as the user that the cron job will be run under. This will show you the path to your executable. You can then use that path (if it’s not already in your PATH variable) in your cron entry: 5 * * * * /your/path/to/php … Read more

crontab PATH and USER

According to “man 5 crontab” you can set environment variables in your crontab, by writing them before your cron lines. There is also an example of a crontab so you just have to copy/paste it : $ man 5 crontab | grep -C5 PATH | tail # and files in /etc/cron.d. These files also have … Read more

How to pass in password to pg_dump?

Create a .pgpass file in the home directory of the account that pg_dump will run as. The format is: hostname:port:database:username:password Then, set the file’s mode to 0600. Otherwise, it will be ignored. chmod 600 ~/.pgpass See the Postgresql documentation libpq-pgpass for more details.