Link to home
Start Free TrialLog in
Avatar of grakem
grakem

asked on

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


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

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

cron_optreminder.php
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

cron_periodic.php
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)

cron_requestprocess.php
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

cron_sendengine.php
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.

cron_statustracker.php
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 :
 /kunden/homepages/32/d133568345/htdocs/mysite/myfolder/cron_bounce.php
 /kunden/homepages/32/d133568345/htdocs/mysite/myfolder/cron_followup.php
 /kunden/homepages/32/d133568345/htdocs/mysite/myfolder/cron_optreminder.php
 /kunden/homepages/32/d133568345/htdocs/mysite/myfolder/cron_periodic.php
 /kunden/homepages/32/d133568345/htdocs/mysite/myfolder/cron_sendengine.php
 /kunden/homepages/32/d133568345/htdocs/mysite/myfolder/cron_statustracker.php  

Any help will be welcome!

ASKER CERTIFIED SOLUTION
Avatar of Julian Matz
Julian Matz
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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).

-J.
Avatar of grakem
grakem

ASKER

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?
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...
Avatar of grakem

ASKER

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?

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...
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:


<?php

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 :)

-J.
Avatar of grakem

ASKER

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

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

- Julian.