Categories
Hosting Tips & Deals Linux Server Administration Tips PHP Tips & Tutorials

Cron jobs (Crontab jobs) tricks and tips on DreamHost

Crontab is a utility tool on Unix-like OS that enables you to make a program daemon scheduled to run at a specified interval. For example, to fetch news feed and import them into your own database every hour on the hour or to send pre-written newsletters at a given time everyday.

With DreamHost you can easily add Crontab jobs at their proprietary web panel, but there are 2 tricks.

With PHP, you can specify the version to run the script, PHP4 or PHP5. DreamHost has both popular php versions installed at different locations:

/*PHP4: */
/usr/local/bin/php
/*PHP5: */
/usr/local/php5/bin/php

With any PHP script, you can always achieve the same results with lynx -dump command that accesses and loads the script as any other browsers would do, thus making the server run the script.

Also it’s required to add this line:

#!/usr/local/bin/php -q

at the top before <?php declaration if you are configuring crontab in command line mode rather than adding it from the web panel of DreamHost.

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.

5 replies on “Cron jobs (Crontab jobs) tricks and tips on DreamHost”

@VK
I’m hosting over 20 websites with DreamHost on their cheapest package, 1 of them is a forum with over 2,000 registered users and thus far everything’s working perfectly.

They sure can handle a forum of your volume. The payment is refundable so you have nothing to lose. Just give it a try and see for yourself.

I’am not a big fan of hosting my cronjobs at Dreamhost it’s too complicated 🙂 ok not really… but there are really good services out there where I can “store” my Crons. But Dreamhost is yet cool very nice host.

Comments are closed.