Laravel 4.2 Set up Cron for Laravel Artisan Command

Brief instructions to setup a Cron job on Ubuntu for a Laravel PHP Artisan Command.

Create a Crontab for the vagrant user
$ sudo crontab -u vagrant -e

Add the following lines:

#test the cron every minute
*/1 * * * * /usr/bin/php /vagrant/ahvla-beta/artisan command:login-access –status=enable –disable-confirm=1 –disable-log=1

#test that the cron is running without PHP dependancy
*/1 * * * * echo “$(date)” >> /vagrant/project-root/cron-contents.txt

Save the file.

Check the contents

$  crontab -l