Cron Jobs For Newbies

Discussion in 'Installation' started by neilhedley, Nov 20, 2003.

  1. neilhedley

    neilhedley Guest

    Greetings all. Been using aMember Pro for a few months now, LOVE it.

    Pretty comfortable with 99% of the features and settings, but the whole "Cron" thing has me completely flabbergasted.

    Here's what I'm trying to do:

    Our website is for a customized fat-loss meal plan, and includes a Body Fat Calculator on the site where registered users are supposed to go every two weeks to enter their new measurements and track their progress. But it's important that they do it once every two weeks.

    What I want to do is be able to send an email to a user when they've reached 12 days since the last time they ran the calculator, reminding them that in two days they're due to run it again. Send 'em another one on the day it's actually due, and send them one every couple of days after that until they actually do it.

    The database gets updated as soon as they run it, so defining the list of who needs to GET the email will be easy. That's not the part I need help with.

    It's actually SENDING it as an automated process that I don't know how to do.

    Help?

    Anyone? Bueller?

    Thanks
    Neil
  2. alex-adm

    alex-adm Guest

    Neil,
    I'm not sure how your quesion is related with aMember ? :)
    it is just common PHP programming question.

    Use cron to execute the following command (every day 00:00):

    0 0 * * * /usr/bin/lynx -source http://www.yoursite.com/cronjob.php

    Then create cronjob.php file - it must be usual PHP file which will run mail() function to send emails.

    Feel free to ask if something is not clear.
  3. techhead

    techhead Guest

    I don't have a cronjob.php (pro version)

    I am looking for a cronjob.php file in the amember folder, but do not see one. I am using pro version so maybe it is different. I did find cron.php; is that the same thing or do I need to create cronjob.php and if so, what are the steps for that?

    Also, I have external cron setup as per the amember CP. How would I know if it were running correctly? The reason I asked is because I was getting emails showing erros before and now I am not getting emails for the last 2 days. Is this a sign of cron working or cron not working?

    It would be nice to have a detailed explanation of cronjobs as part of the manual to clear up some of these little details for newbies.
  4. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    techhead, who said there should be "cronjob.php" in aMember? Please read Neil's question again and you will understand.

    aMember uses cron.php as described at aMember Cp -> Setup -> Advanced.
  5. techhead

    techhead Guest

    cronjob.php

    You said it in your reply above so I thought maybe I was missing the file. I guess the only reason cron is so mysterious to me is because I am not familiar with how or if it should respond when it is working correctly. ie. should I get feedback emails when it works or only if there is an error. Bottom line is, where to look to know it works instead of just having faith. Also, I am still getting this email from cron, but the path and passcode are correct:

    ---
    Looking up mindcleaner.com
    mindcleaner.com
    Making HTTP connection to mindcleaner.com
    Alert!: Unable to connect to remote host.

    lynx: Can't access startfile http://yourdomain.com/members/cron.php?pass=xxxxxx
    ---

    This looks like something is not working, but what is the cause?
  6. pilot

    pilot New Member

    Joined:
    May 24, 2003
    Messages:
    178
    Hi

    There is the possibilty that your server may be scheduled for maitainance, or not respoding for some reason... especially if Cron is set for the early hours ( off peak) when server providers tend to do their service.
    That would explain why only sometimes you are receiving this message.

    I have had this message from time to time, putting this down to this reason ignored it.

    Just another angle.

    Amember user
  7. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Ask your hosting provider/support why does it happen. If they will say it is script problem which they don't resolve, it is wrong - problem is not related with script in any kind. Right problem description:

    When I run the following command as cron job:
    /usr/bin/lynx -source http://yourdomain.com/members/cron.php?pass=xxxxxx
    I get the following error:
    Looking up yourdomain.com
    yourdomain.com
    Making HTTP connection to yourdomain.com
    Alert!: Unable to connect to remote host.

    lynx: Can't access startfile
    http://yourdomain.com/members/cron.php?pass=xxxxxx

    It is definitely a mistake, because I can access file from browser without any problems.
  8. techhead

    techhead Guest

    Cron OK now

    I posted the question to the hosting service as you stated and the error emails are now gone. They didn't say what they fixed, but they did say it should be working now and so it seems to be. In any case, the problem was the hosting server, but is OK now. Thank you!
  9. donroro75

    donroro75 Guest

    Using Cron Job

    I have a similar question, i just got an internship and i have no IT experience. The company wants me to redo their web site and part of the project is to create a form to people to subscribe and send the subscribers periodic email. How I use cron to do this job for me?
  10. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021

Share This Page