Web Hosting Buzz Reseller and Dedicated Server Hosting Forums  

Go Back   Web Hosting Buzz Reseller and Dedicated Server Hosting Forums > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2009, 12:01 AM
turtlepirate's Avatar
turtlepirate turtlepirate is offline
Member
 
Join Date: Feb 2008
Location: Rio Rancho, NM
Posts: 53
Default Setting up a Cron Job

I want to set up a Cron Job for a Wordpress site using the Postie plugin. The plugin requires this code to be ran:

*/5 * * * * /usr/bin/lynx --source http://www.economysizegeek.com/wp-co...e/get_mail.php >/dev/null 2>&1

I really don't know what to do with it. I found the Cron Jobs section in the Cpanel but I'm just confused. I've never done this before. I would like to run this about once an hour or two.
Reply With Quote
  #2  
Old 01-20-2009, 06:02 PM
squinky86 squinky86 is offline
Senior Member
 
Join Date: Jan 2008
Posts: 100
Default

Quick cron tutorial:
The first numbers/wildcards refer to the following:
1 - minute
2 - hour
3 - day (of month)
4 - month
5 - day (of week)

That means that:
*/5 * * * *
will run every 5 minutes on every hour of every day of the month on every month on every day of the week.

To change this to run hourly, you can do something like this:
0 * * * *
This will run every 0th minute (i.e. o'clocks, 1:00, 2:00, ...) of every hour on every day....

or something like this:
5 * * * *
will run at 1:05, 2:05, ....

Next is the command:
Quote:
/usr/bin/lynx --source http://www.economysizegeek.com/wp-content/plugins/postie/get_mail.php >/dev/null 2>&1
Eh, it's ok I guess, but typically, people use wget for this task. This command is what cron runs. There are three default file descriptors:
0 = stdin - used for input
1 = stdout - used for output
2 = stderr - used for errors
The "greater than" symbol redirects output from one of these file descriptors. This command is telling lynx to download the aforementioned page, then redirect its output to the following:
Quote:
>/dev/null 2>&1
By default, if no number is mentioned, it's "1", or standard out. That means that this can be written equivalently (for easier understanding) as:
Quote:
1>/dev/null 2>&1
This directs the page that's downloaded to output its source to the null device (i.e., it throws it away). If there are any errors, it sends it redirects them to stdout, which is then redirected again to /dev/null (i.e., throw them away).

Search for the lynx and wget manuals to understand how those commands work.

When you click on "cron jobs" in cpanel, click on "go advanced" to insert the data there. Alternatively, feel free to use the simpler interface if you're not comfortable using the above directions.

Good luck!

Last edited by squinky86; 01-20-2009 at 06:07 PM. Reason: stupid automatic links....
Reply With Quote
  #3  
Old 01-20-2009, 10:06 PM
turtlepirate's Avatar
turtlepirate turtlepirate is offline
Member
 
Join Date: Feb 2008
Location: Rio Rancho, NM
Posts: 53
Default

Thanks for your handy tutorial! I tried it out in Cpanel but now how do I know if it works? I don't see an option that shows the Cron job that I just submitted. Is there a way to find it?
Reply With Quote
  #4  
Old 01-21-2009, 09:36 PM
squinky86 squinky86 is offline
Senior Member
 
Join Date: Jan 2008
Posts: 100
Default

Quote:
Originally Posted by turtlepirate View Post
Thanks for your handy tutorial! I tried it out in Cpanel but now how do I know if it works? I don't see an option that shows the Cron job that I just submitted. Is there a way to find it?
If it's not showing up after adding it, you need to submit a support ticket. After you click on "standard" or "advanced," you should see your new cron job as one of the entries.
Reply With Quote
  #5  
Old 01-22-2009, 07:01 AM
turtlepirate's Avatar
turtlepirate turtlepirate is offline
Member
 
Join Date: Feb 2008
Location: Rio Rancho, NM
Posts: 53
Default

Thanks again, I must have done it wrong the first time but the second time it showed up. I think I'm all set now.
Reply With Quote
Reply

Tags
cron job, postie, wordpress


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump


All times are GMT. The time now is 06:37 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright WHB Networks LLC. All rights reserved.
SEO by vBSEO 3.2.0