Cron Jobs how to setup using putty and ssh

Hi all
Please can you guys help me to setup cron jobs for an oempro newsletter server.  

I have the following files on my server that need to be made into cronjobs

This module tracks for bounced members. We suggest you to run this CRON module every four hours (6 times per day)

This module tracks members for follow-up auto responders and sends auto responders. We suggest you to run this module every 15 minutes

This module tracks members which are pending for opt-in/out confirmation and sends them reminder emails (if defined mail list settings). We suggest you to run this module every 15 minutes

This module processes the periodic tasks which are defined in oemPro settings. We suggest you to run this module every 12 hours (2 times per day)

This module tracks the defined mail boxes (POP3 accounts) for possible member/visitor requests (subscription, unsubscription, password reminding). We suggest you to run this module every 5 minutes

This module is the main engine for sending your email campaigns. Once you set your campaign and click "Send", it will be saved and sent once this module is ran. We suggest you to run this module every 10 minutes. In this way, whenever you click "Send now" button, your campaign will start being sent in 10 minutes.

This module tracks the status of "active campaigns" and resumes them if the sending process is terminated or halted for any reason. We suggest you to run this module every 10 minutes

The absolute paths to these files are :

Any help will be welcome!

LVL 10
Who is Participating?
Julian MatzJoint ChairpersonCommented:
Hi grakem,

First, you need to su to the user that should run the cron jobs. I let root user run most of my cron jobs...
# su root
# password: ....

Then, you need to open the crontab file for editing. Likely it will open the crontab with the vi editor if installed.
# crontab -e

Your contab file should now be open for editing. Use the keyboard arrows to position the cursor. To go into edit mode, press the <INSERT> button on your keyboard. Now you can insert your text...

I'm guessing that you can run your scripts via the wget tool or Lynx and the HTTP/get method... So you should be able to use the following:

05 */4 * * * wget --spider
*/15 * * * * wget --spider
*/15 * * * * wget --spider
05 */12 * * * wget --spider
*/5 * * * * wget --spider
*/10 * * * * wget --spider
*/10 * * * * wget --spider

When you're finished editing, you can save the file by doing the following:
Hit <ESC> button to go out of edit mode, type a colon ':' and then type wq (write, quit). That should install the new crontab...

Hope this helps...

If wget doesn't work or if you don't have it you could also try lynx...
Julian MatzJoint ChairpersonCommented:
You may also want to add
/dev/null 2>&1

to the end of each line if you don't want the output e-mailed to you every five minutes :)

This command sends the output to nothing (i.e. trash).

grakemAuthor Commented:
wow thanks for the help julian , really excellent!  

I am using shared hosting however they have given me ssh access via putty.  How do I find out if it supports lynx or wget?  I am not even sure what those are?
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Julian MatzJoint ChairpersonCommented:
No problem!

Lynx is a text-based web browser and wget is a tool which I personally use mainly for downloading software etc. but can be used for other things also... The '--spider' switch tells wget to spider a site but not to actually download anything.

I'd imagine that most linux systems would have wget as it is a very useful tool. Best thing to do is just try it and see if it works.

You could do the following to check... In putty type the following:
# wget --spider

and see what happens. You can't really do anything wrong with that command. Same goes for lynx:
# lynx

If neither works, there are other options also...
grakemAuthor Commented:
wow thanks again... If I am running a php script in the cronjob would I still need the spider?  as I want the code to run don't I?

Julian MatzJoint ChairpersonCommented:
Yes, it's better to use --spider because you do not want to actually download anything to your server.
The --spider flag tells tells wget to only spider the requested resource without downloading anything. Using this method would be about exactly the same as if you entered the URL into your browser. The script will still run.

I hope I'm making sense. If not, or if you'd like me to clarify something, please let me know...
Julian MatzJoint ChairpersonCommented:
You can do a simple test with cron and a php script...

Upload a php script called 'test.php' to your server's doc root which contains the following code:


mail('', 'Testing Cron', 'This is a test to see if cron is working', 'From:');


Just change the e-mail addresses...

Then set up your crontab like this:

*/5 * * * * wget --spider

After 5 minutes you should receive a test e-mail.
If it works, don't forget to delete the cron job or you'll keep receiving a test mail every 5 minutes :)

grakemAuthor Commented:
Reakky superb! Thanks for your help.  This is the best help I have ever had in EE!

They should make you king!
Julian MatzJoint ChairpersonCommented:
Thank you, Grakem, for your kind words and the motivation!
I'm glad I could help.

- Julian.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.