I want to update some stuff in my database everyday at 16:00.

So I use crontab which execute command which run my file.php which run the update. It works perfectly when I execute the command in the bash but There is a problem with the crontab.

crontab:

00 16 * * * ./etc/cron.daily/maj_cat

maj_cat

php var/www/dev/update.php

Thanks!

Comments

You are probably missing a prefixing slash in var/www...

Written by Pekka

What is root's home directory? (Or maybe you should lose the . in the path name). Did you set execute bits on maj_cat? And a #!/bin/sh line is best practice nowadays.

Written by LHMathies

Accepted Answer

./etc/cron.daily/maj_cat is a relative path, and var/www/dev/update.php too, try:

00 16 * * * /etc/cron.daily/maj_cat

and maj_cat:

php /var/www/dev/update.php

To you can do:

00 16 * * * /usr/bin/env php /var/www/dev/update.php
Written by Exos
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki