How to set up cron with crontab every day at midnight?

Hey everyone!

I have a problem setting up a cron job that should run every day at midnight.

I have followed this guide, and when testing it the way it is written in the guide (every 10 minutes), it works as expected:

*/10 * * * * cd /var/www/; php /var/www/ > /dev/null 2>&1

When I change the code to this:

00 00 * * * cd /var/www/; php /var/www/ > /dev/null 2>&1

…it doesn’t work anymore and the cron job is not running. Is this not the correct way to run it at midnight every day?

Would appreciate some help!


// Jens.

Hi @jensfilipsson

Its correct. BTW try this

@daily cd /var/www/; php /var/www/ > /dev/null 2>&1

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile: