• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2457
  • Last Modified:

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!

  • 6
  • 3
1 Solution
Julian MatzCommented:
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 http://www.yoursite.com/mysite/myfolder/cron_bounce.php
*/15 * * * * wget --spider http://www.yoursite.com/mysite/myfolder/cron_followup.php
*/15 * * * * wget --spider http://www.yoursite.com/mysite/myfolder/cron_optreminder.php
05 */12 * * * wget --spider http://www.yoursite.com/mysite/myfolder/cron_periodic.php
*/5 * * * * wget --spider http://www.yoursite.com/mysite/myfolder/cron_requestprocess.php
*/10 * * * * wget --spider http://www.yoursite.com/mysite/myfolder/cron_sendengine.php
*/10 * * * * wget --spider http://www.yoursite.com/mysite/myfolder/cron_statustracker.php

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 MatzCommented:
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?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Julian MatzCommented:
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 http://www.google.com/

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

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 MatzCommented:
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 MatzCommented:
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('your.email@address.com', 'Testing Cron', 'This is a test to see if cron is working', 'From: server@yourserver.com');


Just change the e-mail addresses...

Then set up your crontab like this:

*/5 * * * * wget --spider http://www.yourdomain.com/test.php

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 MatzCommented:
Thank you, Grakem, for your kind words and the motivation!
I'm glad I could help.

- Julian.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now