Lately ive started to use cronjobs more and more for the main reason that I want to use cached pages that are high on server load. It’s now almost 1AM and I wanted to fix my cronjob because it wasn’t done and It was a very stupid mistake. I forgot to CHMOD the .php file to 777. Therefor I am going to write this short guide on how you successfully need to setup a cronjob in directadmin. Read more to see how it goes…
To use a cronjob you need a file (I use a php file in my example to explain) that has some commands in it that you want to be automated. We will use cronfile.php. Let’s say it is located in website.com root public_html folder.
First thing you need to do is open directadmin and go to here: http://YOUR_IP:2222/CMD_CRON_JOBS
The page will look like this:

As you can see there is 1 cron job that is currently running. In the command line you need to put the path to your PHP file. It will look like this
/usr/local/bin/php -q /home/*username*/domains/*domain*/public_html/indexcache.php
Replace *username* with your username and *domain* with yoursite.com.
As you can see I have set the cronjob to run every hour of every day on minutes 1,10,20,30,40,50.
The server will run the PHP file every 1,10,20,30,40,50 minute.
In order to make this really work you musn’t forget to CHMOD the PHP file to 777
I hope you learned how to setup a cronjob with this tutorial!
Greetz and feel free to leave comments!
Leave a Reply
You must be logged in to post a comment.
Recent Comments