Setting up cron is fairly straight forward but how would you know if the cron is actually working. Here is a simple test I perform to make sure that cron is working as expected.

Open crontab in you favorite editor

crontab -e

Now add following entry to the file and save.

* * * * * echo "Cron test" > /var/www/html/crontest.txt

What this essentailly does is create a file named crontest.txt inside /var/www/html/ and has content Cron test in it.

Next restart the cron service

sudo service crond restart

Wait for a minute and go to the folder you have given above. You should see file created named crontest.txt

If you see the file, cron is working otherwise time to debug why cron didn’t ran. Check log and stuffs. 🙂