I have an ISP now which supports Cron jobs. I have an interface where I can add files to be run by the Cron job.
Which file should I add?
In the documentation it is said that I should add the cron.php on www.drupal.org.
Is that correct?
Shouldn't it rather be the cron.php in the root of my own site?

As You can see I do not really understand this.

Comments

Dries’s picture

You have to create a small script that uses for example lynx or wget to access your site's cron.php file; in your case that would be http://www.langemark.com/cron.php (I believe). You can find a sample script in Drupal's scripts directory. After you have edited the script, you'll want to tell cron to run that script periodically.

Anonymous’s picture

It would be GREATLY appreciated if someone would take the effort to tell us, STEP-BY-LOVELY-STEP HOW to set up CRONTABS from the VERY BEGINNING TO THE VERY END..

Also, as I understand it, without CRON set up correctly the standard Drupal Search function is wacked...(understood that RSS auto is dead without crontabs). Is this accurate? So, CRON is kind of a big deal, yet the documentation here (or anywhere online) is virtually non existant. Please with tons of sugar on it!

The note above "you'll want to tell cron to run that script periodically" begs the question for those of us new to all this...how?

I've been working on this problem for 4 days now...I finially got my ISP to say they can handle CRON and they want all the info to set up. Their note to me was this:

"what is the file that you wish to run?
what is the path to it (ie /home/xxxxx/xxxx_html/FILE??)
it should be a perl script or cgi file."

Please anyone experienced with CRON set up from scratch?

Anonymous’s picture

www.xxxxxxx.com/drupal/cron.php we are getting the following error message. When manually logging into this url does this supposidly update the site? Does Cron have anything to do with "Search" NOT working..?

ERROR:
"user error: You have an error in your SQL syntax near '' at line 1
query: SELECT c.cid as lno, c.subject as text1, c.comment as text2 FROM comments c WHERE c.status = 0 AND timestamp > in /home/xxxxxxxx/public_html/drupal/includes/database.mysql.inc on line 69.
user error: You have an error in your SQL syntax near 'or changed > )' at line 1
query: SELECT n.nid as lno, n.title as text1, n.body as text2 FROM node n WHERE n.status = 1 AND moderate = 0 and (created > or changed > ) in /home/xxxxxxxx/public_html/drupal/includes/database.mysql.inc on line 69.

Anonymous’s picture

Drupal uses the cron.php script to do all it's regular updating; getting rss feeds etc etc. In order to update these things you need to run the cron.php file which should be directly in your main php directory.

Assume that you have Drupal installed in /home/web/drupal then the cron.php file should be directly in the drupal directory.

To run the cron.php script yourself you will need to surf to the cron.php script manually. Assume that the your web root directory is /home/web/drupal and your website is called mysite.com then you would need to go to http://www.mysite.com/cron.php

When you do this nothing will be displayed but the page will take a few seconds to open, this is the script running updating your site.

Of course we don't want to log in every 30mins and do this manually so Drupal has conviently provided a script ( cron-lynx.sh ) which does automatically exactly what we did manually; go to the correct web site and call the cron.php page to make it update the site. To do this it uses the lynx browser pointed at the cron.php file on your website, you can find this script in script in the /scripts directory in your Drupal installation. In our example this would be /home/web/drupal/scripts.

The cron-lynx.sh script contains 2 lines:

#!/bin/sh

/usr/bin/lynx -source http://gravychain.co.uk/club/cron.php > /dev/null 2>&1

You should change the -source http://... to point to the cron script on your web site.

To test that that works, if you have a bash terminal on your server you can type ./cron-lynx.sh which will run the script. You should see no errors from this but if you do they are likley related to something being wrong with your Lynx setup - it may not be in /usr/bin but somewhere else so you may need to track it down to get the correct path here.

Now we know the scripts all work we need to automatically run the cron-lynx.sh script and this is where cron comes in. Now I am no expert on cron but this is how I have got it to work. Using crontab you tell cron to run a particular script or program and how often you want to run it. The easiest way of doing this is to create a configuration file for cron and then use crontab to load it.

My config file looks like this:

01 * * * * ~/web/club/scripts/cron-lynx.sh

The first number "01" is the minute past the hour to run at. "*" means every interval so "01 *" means run 1 minute past every hour, likewise "01 * * * *" means run 1minute past every hour, every day of every month of every year. It's possible you may be able to specify mulitple time's here as well but I don't know how.

The "~/web/club/scripts/cron-lynx.sh" tells cron what script to run and where to find it. From our example directory above this would be "~/web/drupal/scripts/cron-lynx.sh". The "~" character means in the current users home directory, I could just as easily said "/home/web/drupal/scripts/cron-lynx.sh". You may have to mess around with the exact path a bit if this doesn't work straight off.

Now we need to to save this script somewhere on the webserver. Once you have saved it open a terminal at the location you saved the script ( imagine we saved it as "my_cron_script.txt" ) and type at the command line: crontab -e my_cron_script.txt

This should load the script into CRON and it should work like a dream. Things which are most likley to go wrong are, not having Lynx installed, not having access to CRON, and finding the correct paths to use to scripts.

I hope that makes sense to people.

( To answer your questions directly - I seem to have strayed off course:

  • What is the file you wish to run - cron-lynx.sh
  • What is the path to it - In your Drupal directory it is in the "scripts" directory
  • It should be a perl or cgi script - It's not a perl script or a bash script which should be able to be run by them for you
  • You will need to edit both cron.php and cron-lynx.sh to relate to your site
Mahatma’s picture

So set up a path to your cron file in your host cron setuo, in your cpanel, or have the host do it if you don't see "cron jobs" in your cpanel, with a path like http://www.yoursite.com/cron.php, and check out the way the times are entered. like 0 0 * * * means run it at midnight, and 0/15 * * * * means every 15 minutes ( i think) ... hope you have it up and running. cheers

tatonca’s picture

re: "...hope you have it up and running"

Thanks for jumping in on the forums. We appreciate all the help we can get. However, did you check the date of the post? After 2 years and 1 month I hope 'anonymous user' has his drupal up and running too... ;)

When you reply to a really old post, it ends up taking the place of something newer in the Active Forum Topics. Many users use Active Forums to take a pulse of what's going on during an otherwise busy days.

This is a lesson someone passed on to me - so now I'm sharing it with you. It wasn't something I had thought about at the time. I hope you take it as it is meant, as a little friendly advice...

Cheers

~Tat~

robertDouglass’s picture

... people like me read and learn from an old post that would have otherwise gone unnoticed.

- Robert Douglass

-----
www.robshouse.net
www.webs4.com

Mahatma’s picture

... Why do I suddenly feel like putting my feet back up on my surfboard and putting in to shore for the rest of the day?

tatonca’s picture

...wish I coulda thought of it when I got learn'ed on this...

*sigh*

Would you mind towing me back to shore with you... ;)

~Tat~

rlbeeman’s picture

I am only able to find information on setting up Crontabs through cPanel. I am NOT using cPanel. This does not help me much, because there are no options for "Cron Jobs" or whatever on my home page. I use ISPConfig for a control panel.

-rlb

www.rlbeeman.com

neko’s picture

As an aside, php 4.3.0 does allow for php to be executed from the command line, meaning that you don't have to use lynx/whatever to call the web-page in your crontab - you can just run php from the command line.

ax’s picture

see here

dries: this (not using php cli for cron) should really go into the handbook page / system_help_cron(). as should

00 * * * * /home/www/drupal/scripts/cron-lynx

be changed to

00 * * * * /home/www/drupal/scripts/cron-lynx.sh

al’s picture

There's reasonably good information in the Drupal handbook here. However, If you want a concise guide, do the following:

 

  • Install Drupal
  • Type crontab -e <return>. If you're on Linux, this will probably dump you in vim, which in these modern days of stateless visual editors is a bitch if you don't know how to use it. You should. It's great. But let's not have an editor war. Anyway...
  • Press i. This puts you in insert mode so that you can actually enter text.
  • Type the following (substituting the directory with your drupal site in as appropriate): 00 * * * * /home/www/drupal/scripts/cron-lynx.sh
  • Press <escape>, then type :wq <return>, which will save your crontab and install it.
  • At this point you should make sure the above script is executable, or it won't work. chmod 755 cron-lynx.sh should do the trick. You might also like to check that you have a copy of lynx. (type which lynx).
  • If you wish to know more about the cryptic syntax of crontab, please consult the manpage (man crontab).

Hope that all helps somewhat.

 
Oh, and as Ax says, don't use the command line version of PHP. It won't work properly, as Drupal uses the .htaccess file to change lots of PHP's parameters. Therefore, if you don't call it through Apache, it'll all go horribly wrong...

allen’s picture

im not having so much problems and i understand the proccess and procedures discribed, but are there any recomendations for people without the hostings permissions that do not have any friends with a unix based system and is running on window?
1 )is there no system schedular for windows to to run that cron over the internet
2) can a batch file be created in windows for it
3) i guess worst caes senerio what if i add a refresh java script and leave the browser on that page.
4) i have win2003 server, any options there?
5) are there any online free unix sessions i can run it in?

thanx

allen’s picture

i have found a few programs like WinCron and the free visual cron, i will try them and post back

allen’s picture

i have tryed visualcron out even tghough it seems ok, it doesnt work on scripts i think it creates a macro. i guess if all eles fails i can have a macro created then itll open Ie every hour surf the cron page then closes.. on another computer...lol is ther any other options?

eka’s picture

if your php is in the system path
or if you have access to the php binary

you car make a cron.bat (inside drupal dir where the cron.php is ) like this
c:\php\php cron.php

then you add cron.bat to "scheduled tasks" and add the access path [somedir]\drupal to the "start in"

then you set the settings as you wish (every 1 hour or whatever)
i tryied and worked fine

fotios’s picture

but I do scheduled running of my cron.php on windows using a port of wget. For details see here: blog entry

freyquency’s picture

I'll just add that on a nearly standard installation of Ubuntu linux I had nano (http://www.nano-editor.org/) installed and this is what crontab opened. So the part about "press i" and ":wq" weren't the same. It's basically a combination of esc+letter to do stuff.

al’s picture

For the benefit of those who do not own a Linux system on which to type man crontab, it is reproduced online here:
[crontab manpage].

Eagle-i’s picture

Reading this I myself have a question concerning the cron: my chatlog seems to be growing and growing and I assumed the cron would discard the log older then days, but it doesn't. Is there some function I need to call specifically for the chat-module? How can I fix this?

Anonymous’s picture

When I manually go to my cron url @: http://www."mysite".com/drupal/cron.php

I get the following ERROR: Can someone please tell me what this might be, what is causing it, and HOW TO CORRECT THIS...Crons are still NOT working on my site...Only local images are allowed.

Fatal error: Cannot instantiate non-existent class: xmlrpc_client in /home/"mysite"/public_html/drupal/modules/drupal.module on line 105

Anonymous’s picture

Could be much better. I've also been having nothing but Cron issues, search doesn't work at all, and it's not pinging the drupal site for others to know about my updates...what could this be? Can't wait to see what others will input to assist you with your error message...this should help out others with similar issues with Cron.

I can't help but think that without a !MUCH! easier automatic implementation of Cron within Drupal it will never overcome some of the bigger more successful "community plumbing sites" that are out there...

Good luck Drupal, can't wait to get all these Cron issues resolved so we can plow forward with the power of drupal.

moshe weitzman’s picture

CVS Drupal has a conflict now when it includes the XML-RPC API. it chooses to use the built-in XML-RPC API when available instead of the useful-inc api but these two aren't interchangeable.

i'm sure a fix will come soon. you might be able to get cron to finish by disabling the drupal directory functionality.

bertboerland’s picture

hi

any updates (time to fix) regarding this?

--
groets

bertb

--
groets
bert boerland

Kjartan’s picture

Just not easy to fix. If we remove our own include files and use the PHP extension then we require people to have it available to to them. We will see how it goes.

--
Kjartan

Dries’s picture

Or we stick with our current XML-RPC library (at least for a while) and rename the offending functions? That would work for all parties.

bertboerland’s picture

hi, i dont know what features are not working anymore on my cron setup

1) i think cron should write to the webserver, so one can see what has been processed and what the status is. normally this is devnulled but for troubleshooting purposesses it might be very handy (note, depending on the information that cron writes to the page, it also might give away to much info for creative browsin' wannabees. htacess is your friend?

2) i really would like to know if someone had already solved this problem in anyway, because my site is not listed anymore on drupals site (not that bad), but the content of the site is not indexed anymore by the search hook, fore me rather bad.

any help appriciated.

--
groets

bertb

--
groets
bert boerland

moshe weitzman’s picture

can we unload the standard XML-RPC library and then load usefulinc?

ax’s picture

programatically. if you cannot even load extensions always ...

Anonymous’s picture

I'm also getting the following error when typing in a manual go to cron:

Fatal error: Cannot instantiate non-existent class: xmlrpc_client in /home/"mysite"/public_html/drupal/modules/ping.module on line 37

What's the deal with /ping.module on line 37 ? Anyone know how to fix this...or is it a bug?

Also, EVEN BIGGER ISSUE SEARCH IS STILL NOT WORKING ON MY SITE comments are ok but nothing else is being looked at. ANYONE, this is weeks now of issues with 4.1

randybrown’s picture

After several attempts to get the cron-lynx.sh script to run on my hosted server, I ended up using wget to run my cron.php file.

I deleted the crontab job which pointed to the .sh script and replaced it with the following:

01 * * * * wget http://domain.com/cron.php

This works beautifully here. Very reliable and timely.

I'm going to take the recommendation from someone here who said it might be a good idea to rename the cron.php to somethign else, so it can't be run by outside processes.

I hope this helps.

Pedalopolis :: Pedal Power in the Miami Valley

paddy_deburca’s picture

Using wget http://domain.com/cron.php creates a local file called cron.php; if a cron.php exists, a cron.php.0 gets created, and then a cron.php.1 and so on.

To avoid this the following cron entry should be used

01 * * * * wget -O - http://domain.com/cron.php >/dev/null 2>&1

All output from the wget gets sent to stdout which inturn gets sent to /dev/null.

Paddy

Mahatma’s picture

I have been looking over these old posts about cron. There are quite a few of them. It's always a good idea to look over the older messages whenever I have a problem or a question, because chances are someone else has run into the same problem before. I think that may actually be the reason the old posts get kept around, I'm not sure though.

Anyway I happened to be lucky (this time) and found a great place for my site. I say great because it has all the bells and whistles including smart little help explanations. I thought I might share my cron ideas in case anyone else ever ever ever looks through the old posts for some info.

* * * * * is the timing, and these 5 asterisks will run a cron job every minute.
*/50 * * * * will run it at 10 till the hour every hour.

on my linux box I have wget installed so the commands I use are ...

wget -q -F -O - http://mysitename.com/timely.php >/dev/null 2>&1

The "web get" commands are -q for quiet, -F to force the input file to be treated as HTML, and -O to do something I forget what. The ">/dev/null// " sends output off into the deep dark. With this command line there is no output file created in my root dir every time cron runs (yes I had to delete about 50 of them before I realized wget creates them by default), and the other output is directed to a black hole if there is any so the built in messages and stuff from wget don't pop up someplace where not wanted.

The other option for anyone to use is the poormancron module available here I believe. That should cover everyone!

If case anyone is interested here is the --help output from wget

GNU Wget 1.8.2, a non-interactive network retriever.
Usage: wget [OPTION]... [URL]...

Mandatory arguments to long options are mandatory for short options too.

Startup:
-V, --version display the version of Wget and exit.
-h, --help print this help.
-b, --background go to background after startup.
-e, --execute=COMMAND execute a `.wgetrc'-style command.

Logging and input file:
-o, --output-file=FILE log messages to FILE.
-a, --append-output=FILE append messages to FILE.
-d, --debug print debug output.
-q, --quiet quiet (no output).
-v, --verbose be verbose (this is the default).
-nv, --non-verbose turn off verboseness, without being quiet.
-i, --input-file=FILE download URLs found in FILE.
-F, --force-html treat input file as HTML.
-B, --base=URL prepends URL to relative links in -F -i file.
--sslcertfile=FILE optional client certificate.
--sslcertkey=KEYFILE optional keyfile for this certificate.
--egd-file=FILE file name of the EGD socket.

Download:
--bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host.
-t, --tries=NUMBER set number of retries to NUMBER (0 unlimits).
-O --output-document=FILE write documents to FILE.
-nc, --no-clobber don't clobber existing files or use .# suffixes.
-c, --continue resume getting a partially-downloaded file.
--progress=TYPE select progress gauge type.
-N, --timestamping don't re-retrieve files unless newer than local.
-S, --server-response print server response.
--spider don't download anything.
-T, --timeout=SECONDS set the read timeout to SECONDS.
-w, --wait=SECONDS wait SECONDS between retrievals.
--waitretry=SECONDS wait 1...SECONDS between retries of a retrieval.
--random-wait wait from 0...2*WAIT secs between retrievals.
-Y, --proxy=on/off turn proxy on or off.
-Q, --quota=NUMBER set retrieval quota to NUMBER.
--limit-rate=RATE limit download rate to RATE.

Directories:
-nd --no-directories don't create directories.
-x, --force-directories force creation of directories.
-nH, --no-host-directories don't create host directories.
-P, --directory-prefix=PREFIX save files to PREFIX/...
--cut-dirs=NUMBER ignore NUMBER remote directory components.

HTTP options:
--http-user=USER set http user to USER.
--http-passwd=PASS set http password to PASS.
-C, --cache=on/off (dis)allow server-cached data (normally allowed).
-E, --html-extension save all text/html documents with .html extension.
--ignore-length ignore `Content-Length' header field.
--header=STRING insert STRING among the headers.
--proxy-user=USER set USER as proxy username.
--proxy-passwd=PASS set PASS as proxy password.
--referer=URL include `Referer: URL' header in HTTP request.
-s, --save-headers save the HTTP headers to file.
-U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION.
--no-http-keep-alive disable HTTP keep-alive (persistent connections).
--cookies=off don't use cookies.
--load-cookies=FILE load cookies from FILE before session.
--save-cookies=FILE save cookies to FILE after session.

FTP options:
-nr, --dont-remove-listing don't remove `.listing' files.
-g, --glob=on/off turn file name globbing on or off.
--passive-ftp use the "passive" transfer mode (default).
--active-ftp use the "active" transfer mode.
--retr-symlinks when recursing, get linked-to files (not dirs).

Recursive retrieval:
-r, --recursive recursive web-suck -- use with care!
-l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).
--delete-after delete files locally after downloading them.
-k, --convert-links convert non-relative links to relative.
-K, --backup-converted before converting file X, back up as X.orig.
-m, --mirror shortcut option equivalent to -r -N -l inf -nr.
-p, --page-requisites get all images, etc. needed to display HTML page.

Recursive accept/reject:
-A, --accept=LIST comma-separated list of accepted extensions.
-R, --reject=LIST comma-separated list of rejected extensions.
-D, --domains=LIST comma-separated list of accepted domains.
--exclude-domains=LIST comma-separated list of rejected domains.
--follow-ftp follow FTP links from HTML documents.
--follow-tags=LIST comma-separated list of followed HTML tags.
-G, --ignore-tags=LIST comma-separated list of ignored HTML tags.
-H, --span-hosts go to foreign hosts when recursive.
-L, --relative follow relative links only.
-I, --include-directories=LIST list of allowed directories.
-X, --exclude-directories=LIST list of excluded directories.
-np, --no-parent don't ascend to the parent directory.

Mail bug reports and suggestions to bug-wget@gnu.org

petertan’s picture

I run the following :

http://www.mysite.com/cron.php

and I get this error :

user error: Duplicate entry '' for key 2
query: INSERT INTO users (created, changed, uid) VALUES ('1114592967', '1114592967', '19') in /home/petertan/public_html/includes/database.mysql.inc on line 66.

What does it mean?

americariocan’s picture

Anyone figure out how to get a CPanel cron task to complete correctly?

I've tried everything... read the whole forum from top to bottom...

So like Gunnar, I'm stumped.

pdinnen’s picture

I am not an expert so I can't say whether this is the best way to do it, but I found a Cpanel set up elsewhere on the Drupal site that seems to work for me, with the job run every 30 minutes.

In Cpanel, go to Cron Jobs > Advanced (Unix Style)

Set 'minute' field to 30
Set 'hour', 'day', 'month', 'weekday' fields to *
Set 'command' field to wget -O - http://www.MyDomainHere.com/cron.php >/dev/null 2>&1

That seems to do the job for me, hope that helps.

green monkey’s picture

hi pdinnen
I have been struggling with crontab on and off for over week and haven't got to excute correctly yet. I've read this page so many times - I can remeber the node #.

I was really hoping that what worked for you was going to work for me, but this is what I get back:

/bin/sh: /hsphere/local/home/'myaccount"/"mysite.com"/scripts/cron-lynx.sh: /bin/sh: bad interpreter: Permission denied

i don't even know why it's saying that or why its looking in that area

its no fun being at the mercy of a silly little program called crontab, especially since it looks so simple to set up

I also have to work from Cpanel

Mahatma’s picture

If you could please say what your command is people can look and see if it looks right. Are you using wget or some other cron command executer?

If you get that msg using wget then your cpanel may have a different command executer ... that's why I mentioned it. You may just need to ask your hosting company what the executor is, wget or binsh or what...

green monkey’s picture

sorry
I'm doing this like the link 2 above - andit return the error above

Set 'minute' field to 30
Set 'hour', 'day', 'month', 'weekday' fields to *
Set 'command' field to wget -O - http://www.MyDomainHere.com/cron.php >/dev/null 2>&1

I'll go ask ... but you just gave me an idea I hadn't thought of .. path? to wget?

sofiya’s picture

go ask your web hosting provider if there's a php cli installed and the path to your web folder. if it's installed you can actually put in the command to run field: 'php /path_to_your_web_folder/cron.php'
example:
php /home/[user_name]/public_html/cron.php

hth.

"If you build it, they will come." -- Field of Dreams

Mahatma’s picture

php cli is another way to run cron jobs, but it may not act like it is being called from the web ... I'm not sure if that's necessary to have the cron job run correctly but it may be. wget I think stands for web-get ... and it simulates access from the web as opposed to from the file system. So if you get instructions to run it from a url like php http://www.yoursite.com/cronfile.file ... that would run it "from the web"
??? this making any sense?

I guess the main thing is to see what your host says ;)

There's another one too ... like a shell access command ... if you have shell access, but most hosts disable that because of pranksters hacking things up.

green monkey’s picture

i don't know if this makes a difference

mySQL is ran off a different server

i tried a few things my host recommended, still not working but I have a new error

Warning: main(sites/default/settings.php): failed to open stream: No such file or directory in /hsphere/local/home/myaccount/mysite.com/includes/bootstrap.inc on line 642

i get this when i run this (tried wget to death) host says I really don't need it .. and yet to discuss Cli (what do I know)

/usr/local/bin/php /hsphere/local/home/myaccount/mysite.com/cron.php

anyone?

Mahatma’s picture

Let me do some research. It would have been nice if your host had some specific details for you. Mine was not forthcoming about the commands for cron either, but luckily they had wget installed and those commands worked for me when I tried them on my own, after they didn't answer my emails right away ;)

Have you looked at the poorman's cron module? It is a bigger load on the server but it apparently works for those who can't use wget or a similar system command.

sofiya’s picture

im using my host's php cli to run cron.php with no problem at all. please make sure that '/hsphere/local/home/myaccount/mysite.com/cron.php' is the correct path to your cron.php

"If you build it, they will come." -- Field of Dreams

green monkey’s picture

I received a new path to wget from the host sys admin - 3rd one actually. Makes me feel better, these guys do this for a living and I'm just a midnight hacker with a large cup of coffee .. going to try wget again.

gong to try wget again instead of the one in my last post which caused errors in bootstrap,inc

they tried to tell me the program is bad, then
I tell them the program runs from the browser window - thank goodness - thats about all I know to say.

green monkey’s picture

as per above... my host gave me another path to try.

now I'm not getting a email back - the ones i was getting were only error ones - he tells me if it is working i won't get an email

is this correct? they've told me so many things - i need ask somone else

laura s’s picture

I confess I'm not up on cron syntax, but this has worked for me on CPanel:

wget -q -F -O - http://yourdomain.com/cron.php >/dev/null 2>&1

This will result in no email sent. (Who needs a full inbox when you can simply look at your logs?) Be sure to set minutes as "*/15" or whatever interval you want, and "*" for hours etc. Be sure to not set your cron to run too frequently or you may violate your TOS.

Be sure to read the Drupal documentation, as there is good discussion of this in the comments on those pages regarding cron.

.:| Laura • pingV |:.

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

freyquency’s picture

30 * * * * /path/to/drupal/scripts/cron-lynx.sh

and the contents of cron-lynx.sh:

#!/bin/sh
/usr/bin/lynx -source http://sitename/cron.php > /dev/null 2>&1

I'm not sure how to explain that some people cron the cron.php file and some the cron-lynx.sh file, but this worked for me - and the other did not.

Kato’s picture

But wow. I have a CPanel and getting my cron to work correctly was driving me nuts. This little bit right here finally did the trick for me. No emails or anything, but I went in and checked the search page of the admin for my site and it now reads that 100% of my site has been indexed. So it seems to be working just fine. On a side note, I checked my files and there is no second cron.php file that someone else mentioned earlier. This seems to have worked well.

Just thought I should share in case others come across a similar issue or anything.

http://nglofsalina.com

bebe007’s picture

I had your problem with setting up a cron job to access one of my pages that was sending e-mail to people registered in a database. I uset the wget command but someone told me that this command actually downloads the page. Don't ask me where.
So I uset lynx instead and works like a charm.
IE:
lynx mydomain.com/myfile.php

That's all. Hope it will rok for you too.

ATorres617’s picture

http://drupal.org/project/poormanscron

I've used it and it seems to work just fine in development. I'm going to be hosting some time soon and wanted to see if there are any serious drawbooks.

Thanks

ToddZ-1’s picture

A little late spotting this question, but yes, I've been using poormanscron in production for a year and it works without a hiccup.

rehash’s picture

lynx also downloads the page, the myfile.php file is served by a web server the same way for both browser or downloader

thisismyurl’s picture

My server supports CRON but it acts up sometimes, so I've had to improvise a solution that is much simpler.

In my index.php file, I've added the following line at the end:

if (date("i") < 15 && date("G") < 5) {require_once 'cron.php';}

In effect, it says "if the current time is within the first 14 minutes of the first four hours of the day, run the cron code".

Luckily my site isn't high traffic but I do get visits after midnight so the script will run itself every night *if* I get a visitor who happens to come by in the first 15 minutes of 12,1,2,3 or 4 AM.

Igbonine’s picture

Just bookmarking