Cron job

Discussion in 'Troubleshooting' started by danniella, Jun 30, 2008.

  1. danniella

    danniella New Member

    Joined:
    Jun 16, 2008
    Messages:
    5
    Hi, In may ameber admin, I have this message in red at the top of my page, can you advice me what I need to do to fix please?
    --------------------------------------------------------------------------


    Cron job has been running last time at 06/24/2008 06:00:34, it is more than 24 hours before.
    Most possible external cron job has been set incorrectly. It may cause very serious problems with the script


    --------------------------------------------------------------------------
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
  3. ryanbsmith

    ryanbsmith Member

    Joined:
    Apr 29, 2008
    Messages:
    31
    I have this message as well. Apparently I didn't setup things correctly, but I've removed the cron job altogether and am still receiving this message, though the date and time haven't changed. Do I have to set it up correctly now before this message will disappear? I just assumed it would go away after 24 hours or so, but that doesn't seem to be the case.
  4. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    Ryan the message is telling you that certain functions required on a daily basis have not been performed since date "x" and the error message will remain until you set up a cron

    Cron is a resource available as part of a normal server setup. A cron for use with amember will run a program named http://yoursite.com/amember/cron.php which provides a set of housekeeping and aging functions within the Amember database. You CAN run the function manually each day (which is kind of a dumb thing to do) but you are well advised to set up a cron which is nothing more than an auto-scheduler, to do it automatically for you. As the only function of a cron job is to run whatever you tell it to run then you must provide the commandline parameters for the task's execution

    Due to the resources and set up of your server as provided by your hosting company, there are many possible configurations of the trigger command within the cron you set up. Some are given in the documentation of Amember like David wrote at http://manual.amember.com/Setup_a_Cron_Job such as:

    /usr/bin/curl -s http://yoursite.com/youramemberdirectory/cron.php
    /usr/bin/wget -o/dev/null -O- http://yoursite.com/youramemberdirectory/cron.php
    /usr/local/bin/lynx -source http://yoursite.com/youramemberdirectory/cron.php
    /usr/local/bin/curl -s http://yoursite.com/youramemberdirectory/cron.php
    /usr/local/bin/wget -o/dev/null -O- http://yoursite.com/youramemberdirectory/cron.php

    but there are other commandline options depending on how your hosting company set up their servers for you.

    If you are unfamiliar with running php files from a cron and the above commandlines read like Chinese to you (or read like Urdu if you happen to be Chinese) then the topic is covered in a large number of posts on this forum or can be found by a Google on the topic in the greater world of the web.

    Perhaps a more practical option for "non techies" that I'd suggest, is asking your hosting company's tech support which command structure to use to run a php file on their server. I have found thru bitter experience over the years that some tech support staff (particularly the ones on the frontline support phones), only read answers from a manual or knowledgebase of questions typically asked of them and are in fact "dumber than a frog on a cooktop", then I'd suggest pointing them to the cron setup manual page in amamber's server to help them !

    Otherwise if you wish to DIY then Id suggest a trial and error approach setting cron to run every few minutes (5) so you don't have to wait forever to try the next option, until you find the correct commandline options peculiar to your server setup. Once you find the right one then DON'T FORGET to set the cron back to a more sensible timing of once per hour.
  5. ryanbsmith

    ryanbsmith Member

    Joined:
    Apr 29, 2008
    Messages:
    31
    Thanks so much for your response. I added a cron job on Tuesday and it attempted to run for the first time later that night. I evidently didn't add it correctly since I received this message the next morning. I simply removed the cron job since it didn't work, and I didn't do anything beyond these two steps.

    So I'm a bit confused about it telling me that "certain functions required on a daily basis have not been performed." The cron job I added wasn't required, it was simply an attempt on my part to automate my database backup once a day. I've had aMember up and running fine for several months now, and this was my first attempt to automate the database backup.

    By adding this cron job that failed, I didn't create a situation where something that is required to run no longer does, did I? There were no cron jobs listed previously in my host's cPanel, so I'm not sure how I could have prevented something else from operating correctly.

    I'm obviously new to this specific area of things, but am working to better understand it. Thanks for the support. :)
  6. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    Deleted post
  7. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    OK there maybe some confusion created by how amember names the php file that performs its housekeeping functions.
    Amember provides a file in the amember directory called CRON.PHP which is (derrrrr) a PHP file and it runs daily housekeeping functions on your database. CRON.PHP is NOT a cron job it is the housekeeping program provided by amember which needs to be run to perform database cleanup and aging functions.
    You SHOULD be running this file either manually (definitely not my recommendation) or by setting up a cron job (server program - not to be confused with cron.php). to do it automatically for you.
    Apart from whatever automated functions you maybe trying to set up with a cron for your site you should have a cron job running the following :
    /yoursite/amemberdirectory/cron.php as well.
    You asked :
    "By adding this cron job that failed, I didn't create a situation where something that is required to run no longer does, did I? There were no cron jobs listed previously in my host's cPanel, so I'm not sure how I could have prevented something else from operating correctly."


    No but you should have a cron setup to run www.yoursite/youramemberdirectory/cron.php anyway.
    Simply the way amamber picks up a failed cron alerted you to the fact that the cron.php file wasnt being run anyway...just blind luck I guess and while you broke nothing it simply alerted you to a fact that you missed out setting up the step in your set up. Depending on how you set up amember then there are some functions of maintenance you can accomplish manually via the control panel but some require cron.php to be run, so best you set it up anyway.
    If you are still having problems get back to me.
  8. ryanbsmith

    ryanbsmith Member

    Joined:
    Apr 29, 2008
    Messages:
    31
    Wow, I just looked at "Setup a Cron Job" in the manual and I can't believe I skipped this step -- assuming that I did. Is there anywhere I can look to see if it has ever run? I will just follow these steps in the manual, unless you know of a reason to do things differently since I didn't add the job to run during my initial aMember setup.

    Thanks again for the help, I really appreciate it.
  9. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    On cPanel at the top of the cron job creation screen there is provision for an email address that will send the output of your cronjob. If you get a failure you will be notified.
    Also if successful the red error message will disappear from your amember admin screen.

    And NO it wasn't run if there wasnt a cron job existing in your setup. Your linux log files (assuming you are running a LAMP setup) will show if its been run if you REALLY want to wade thru all the crap to find out. Don't ask me about a Windoze server set up as I don't use them for our servers.

    A cron job, if you place a email notification address in its setup, will notify you of the output of a cron job. Seeing amember's cron.php has no output at all, with the exception of failure messages, if it bombs, then you will only be notified by email on a failure condition.
  10. ryanbsmith

    ryanbsmith Member

    Joined:
    Apr 29, 2008
    Messages:
    31
    Yes, I created a separate email account just for that purpose. I will set this up and am glad to know it will remove that message once it runs successfully.
  11. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    Glad to be of assistance. I've tried to keep it as lo-tech as possible because a lot of people struggle with this part of setup seeing as how it delves a little into the strange and muddy mysteries of operating system utilities and I know just how much y'all sweat over dealing with those little critters. Let us know when you have success to give heart to those still struggling with it and remember to set your cron run for every 5 mins UNTIL you get it right. That way you wont waste hours waiting between test runs, THEN set it back to an hour when its finally working (dont forget this last step)
  12. ryanbsmith

    ryanbsmith Member

    Joined:
    Apr 29, 2008
    Messages:
    31
    Great, I've just set it to 5 minutes and hope to see a success message appear soon. I already had external cron checked in the Advanced area of aMember Setup, so it scares me a bit that I didn't have it setup correctly since I do rebilling and it says it's necessary for rebilling! I haven't noticed anything wrong since starting with aMember, but I guess I've been lucky! More soon...
  13. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    You wont get a success message but you will get a failure message (if it fails) ...aren't operating developers thoughtful ! The trouble with success messages is that once its running you will be deluged by them and to turn off notification would be a dangerous thing as you wouldn't be alerted to failures. (thats why they put errors messages in red ...just so you will notice them)
  14. ryanbsmith

    ryanbsmith Member

    Joined:
    Apr 29, 2008
    Messages:
    31
    Update: No error message or success message received by email, so I logged-in to aMember Admin and the red error message has disappeared! What a relief!

    Thanks again so much, calisolllc. Hopefully I can return the favor by helping someone else out here at some point. I've always learned the most by making mistakes, and this time is no different. :)
  15. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    Thats the BEST way to learn and why those of us that have learned by our own errors help others. We just love to watch'em sweat and squirm ! It appeals to our sense of vengeance and justice.
  16. jimjwright

    jimjwright New Member

    Joined:
    Sep 12, 2007
    Messages:
    162
    Hello,

    It sounds like you got things working. But heres a tip for others trying to configure cron.php to run from a cron job is to add the following parameter to the invoking of cron.php

    cron.php?ok=1

    The ok=1 will cause cron.php to write the following to debug log so that you absolutely know for sure if cron.php is running.

    cron.php started
    cron.php finished

    You can access the debug log from the aMember Control Panel and should be a log that you get use to looking at when having problems. Alot of hints can be gathered from the information logged here.

    Anyway glad you got it working.

    Jimmy
  17. ryanbsmith

    ryanbsmith Member

    Joined:
    Apr 29, 2008
    Messages:
    31
    Thanks for the tip, Jimmy. :)
  18. tridean

    tridean New Member

    Joined:
    Aug 11, 2008
    Messages:
    21
    I can't quite get the answer, but am I to believe that I "HAVE" to set up this cron task? Is this a pre-requisite of Amember running properly?

    Thanks
    Dean
  19. jimjwright

    jimjwright New Member

    Joined:
    Sep 12, 2007
    Messages:
    162
    Hello,

    The scheduled cron job allows aMember to do the following on a daily basis:

    1. Rebill recurring memberships that have expired.
    2. Mail not completed members after so many days.
    3. Do email auto-responders.

    The most common need for cron though is for rebilling monthly subscriptions that have expired and need to be renewed. If you don't sell any time of memberships or products that require rebilling then most likely a cron job is not needed.

    Jimmy
  20. tridean

    tridean New Member

    Joined:
    Aug 11, 2008
    Messages:
    21
    thanks. I don't as of yet, but I will in due time, and I have managed to set it up cheers

Share This Page