Go Back   Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum > Sales > WebHosting UK Services

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-05-2008, 08:33 AM
Member
 
Join Date: Jan 2008
Location: Lytham UK
Posts: 37
Default Wget

Hi I am trying to run a cron job once a day but wget (which chat told me is the command type to use) is giving an error

This is the cron

wget -q -o /dev/null www.windermerelodge.co.uk/send/send.php
(I have amended the command in case any naughty peeps tried to execute it
This is the result

/bin/sh: /usr/bin/wget: Permission denied

If I just use the

www.windermerelodge.co.uk/send/send.php

command in the address bar it executes fine

Any ideas?

John
Reply With Quote
  #2 (permalink)  
Old 02-05-2008, 09:37 AM
Senior Member
 
Join Date: Jan 2007
Posts: 939
Default

I believe there are various methods to do this. I use root instead of a url:
php /home/username/public_html/send/send.php
and have no problems.

I actually have my db connection and cron files above root for further protection, so they can't be run from a browser. i.e:
php /home/username/send/send.php
__________________
West Dorset Community
Reply With Quote
  #3 (permalink)  
Old 02-05-2008, 10:02 AM
Member
 
Join Date: Jan 2008
Location: Lytham UK
Posts: 37
Default

Hi Jon

Thanks that seems to have worked

To stop it sending me messages do I just add the /dev/null at the end?

Cheers John
Reply With Quote
  #4 (permalink)  
Old 02-05-2008, 11:18 AM
Senior Member
 
Join Date: Jan 2007
Posts: 939
Default

Hi John, I think you append :
>/dev/null 2>&1
to the end to stop emails
http://www.adminschoice.com/docs/crontab.htm#Example

so : php /home/username/send/send.php > /dev/null 2>&1
__________________
West Dorset Community

Last edited by jon123; 02-05-2008 at 11:27 AM.
Reply With Quote
  #5 (permalink)  
Old 02-05-2008, 11:27 AM
Member
 
Join Date: Jan 2008
Location: Lytham UK
Posts: 37
Default

Thanks

I am familiar with the "/dev/null" bit what does the "2>&1" bit do?

Cheers

John

Answering my own question

> /dev/null pipes standard output to a black hole
2>&1 send error message to the same place

1 is standard output, 2 is error output

So to have only errors sent (which is in fact what I want) I just use > /dev/null

See a very useful article here for more detail

- http://www.xaprb.com/blog/2006/06/06...vnull-21-mean/

Last edited by Pommie; 02-05-2008 at 11:33 AM.
Reply With Quote
  #6 (permalink)  
Old 02-05-2008, 11:42 AM
Senior Member
 
Join Date: Jan 2007
Posts: 939
Default

Good article!

I actually want my emails, there has been a couple of instances where the cron jobs have stopped working. Something to do with a vps service stopping and not auto-restarting. Although this I understand has now been sorted, i still need to make sure that every day i get my 3 cron emails letting me know the scripts have been executed.
I am glad they are just daily though, if i received an email every 15 minutes i think i would need to blackhole them.
__________________
West Dorset Community
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:56 AM.
Copyright 2002-2007 WebHosting.uk.com. All rights reserved.
Web Hosting UK Forum