Cron jobs on Dreamhost

gusaus - November 7, 2006 - 18:35

Is there some trick to getting cron jobs to work with Dreamhost? I've never been able to get things like the aggregator to automatically update.

Thanks,
Gus

There is how I do it on

mirko - November 7, 2006 - 18:57

There is how I do it on shared hostings where I am not allowed to automate cron tasks on the server.

I use a website: www.webcron.org where you can setup cron tasks. This websites seems to be only in french, but there should be some similar websites in english...
If you use this one, be careful not giving your main email adress, they'll use it to spam you...

Thanks for that...

gusaus - November 7, 2006 - 19:17

hopefully there's another less spammy option?

Have you seen this page?

mirko - November 7, 2006 - 19:20

Have you seen this page?

Just revisited that...

gusaus - November 7, 2006 - 19:35

I came across that earlier and was unsuccessful. I'll give it another go.

Thanks!

Open your SSH client and

benthere - November 14, 2006 - 08:29
  1. Open your SSH client and login.
  2. Type the following and hit enter:
    crontab -e
  3. Paste this in there (replacing example.com with your domain and 39 with any number from 0-59):
    39 * * * * /usr/bin/wget -O - -q http://www.example.com/cron.php
  4. Press Ctrl-X
  5. Press Y
  6. Press Enter

--
Cheap, reliable Drupal hosting: 200GB | 2TB
Save $75| DH75OFF coupon for 1 year ($3.75/mo!)
Save $50| DH02SETUP coupon for monthly ($10/mo!)

can't figure it out

Chill35 - January 1, 2007 - 14:39

I have trouble with the first step :

  1. Open your SSH client and login.

Where is the "SSH" client in the Dreamhost Control Panel ?

I downloaded PUTTY. A software mentioned in the documentation here.

I run PUTTY, I enter the host name, I click "open", a command-line prompt appears in a console, I get a message asking "Are you sure this is the right computer you're accessing ? you don't have it cached..." I say "yes". I enter next to the prompt... my user name, enter, then my password, enter, a welcome message appears... and the console window closes. End of story. No window of anything is open on my desktop... I use Windows XP.

Can someone help here ?

I did read these two pages with all the comments :
http://drupal.org/node/31548
http://drupal.org/cron

Caroline

--

Chill35 - January 1, 2007 - 14:53

I enabled shell access in DreamHost for myself, using the DreamHost wiki.

There was many options as far as "path" for the shell access. I used the default path. I don't even know what I am doing.

I will retry with PUTTY in a few minutes.

YEAAAAAAAH

Chill35 - January 1, 2007 - 22:39

Yep that was it. I didn't have "shell access".

Much later, I ran putty and this time, past the welcome message, I wasn't kicked out. I followed the instructions above.

I entered crontab -l at the command prompt after all the steps and my cron job showed up.

Will report back if the cron has run... from the Drupal logs.

Thank you for such exquisite instructions.

It should make it into the documentation.

Caroline

Whoooooo HOOOOOOOO

Chill35 - January 1, 2007 - 22:43

Benthere...

Here is what my log tells me (I used the "39" like you) :

cron 2007-01-01 17:39 Cron run completed Anonymous

Bliss....

I love you.

Caroline

You could set up a schedule in windows xp.

hectorplus - January 11, 2007 - 03:46

The way i have it set up:
I downloaded wget, installed it in my windows directory, then open the scheduled task, then configure my cron job to run every x hours/minutes.

Tecito.com
Comunidad Latina en Canada, regístrate ya! Join the growing latin community in Canada.

You are a saint

mwoida - February 23, 2007 - 15:45

Thank you for your perfectly succinct instructions, they worked beautifully. (I don't mind being treated like an idiot if it gets the job done!)

I just fixed this issue on

oc - January 10, 2007 - 11:18

I just fixed this issue on my site. I decided to use the cron-lynx script that is provided within Drupal.

I created a cron entry like this:
45 * * * * /home/odb/organizersdb.org/scripts/cron-lynx.sh

I went ahead and tried running it from the command line by typing:

/home/odb/organizersdb.org/scripts/cron-lynx.sh

and I got a permission denied error. Turns out that to get it to run, I had to change the permissions:

chmod 755 cron-lynx.sh

which makes it executable. Then I could run it but still, the run did not show up in the logs of my Drupal site.

Then I opened cron-lynx.sh in a text editor and noticed that it says:
/usr/bin/lynx -source http://yoursite.com/cron.php > /dev/null 2>&1

Well obviously this needs to be customized to have our site in it:
/usr/bin/lynx -source http://organizersdb.org/cron.php > /dev/null 2>&1

THAT did the trick, now the cron run shows up in the Drupal logs when
I run it from the command line.

-rich

alternative method for DreamHost cron jobs

droopy75 - February 28, 2007 - 01:17

I tried the wget method explained above, but for some reason it wasn't working for me. So I contacted DreamHost support and they suggested using php instead of wget in my crontab file.

So, I *was* using (this did not work):
0 * * * * /usr/bin/wget -0 - -q http://my_domain.com/cron.php

But then switching my crontab to the following worked fine:
0 * * * * /dh/cgi-system/php.cgi /home/my_dreamhost_user/my_domain.com/cron.php

It depends on what version of PHP your domain is running; the above example is for PHP 4. For PHP 5, you would change "php.cgi" to "php5.cgi". If you don't know your PHP version, check the DreamHost Control Panel (domains > manage domains > edit) or your Drupal admin screens (/admin/logs/status/).

(There's an alternative method that requires you to edit the contents of cron.php itself, but I decided to steer clear of that one.)

More info here: http://dhurl.com/?al9HvqwB

I hope that helps anyone else who gets stuck like I did.

droopy75

Now very easy

Jon.Homan - July 27, 2007 - 13:09

Adding cron jobs on Dreamhost is now very easy via their web panel.

In the Goodies -> Cron Jobs section add a new cron job and simply enter the following for the command:

wget -q http://notesonsurvival.info/cron.php

Saving this modifies the user's crontab. If you ssh into your account and run

crontab -l

there will be an entry something like this

@daily /usr/local/bin/setlock -n /tmp/cronlock.728470.6042 sh -c $'wget -q http\072//notesonsurvival.info/cron.php'

Works for me!

wget -q --delete-after

wwwoliondorcom - September 24, 2008 - 17:55

hi,

On dreamhost wiki http://wiki.dreamhost.com/Cron

they advice to use:

wget -q --delete-after http://www.MYSITE.com/cron.php

but is it necessary to use --delete-after ?

Thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.