Buying 25$ in exchange of a simple piece of php code

Discussion in 'Programming' started by sabin, Nov 19, 2011.

  1. #1
    UPDATE : CASE CLOSED, the job has been done alrady.

    -
    Hello,

    I need someone to edit a website's config.php file to make the website auto-send me an email when the database connexion fails.

    Using that part :
    mysql_connect( ... ) or die( ... );

    Context : an underpowered server whose database server will sometimes get "stuck" with a "too many users" error, and when it is stuck, the connexion fails, and the ONLY way out of this is to reboot the server.
    The server can only be rebooted manually by me, the admin - but I have to be informed that a reboot is required because the server is down !
    So, I need a notification to be sent to me, just once, when the server needs me.

    Rules :
    1 - that server doesn't accept cron jobs programming
    2 - EVERYTHING must take place inside the "mysql_connect() or die()" part, you have to write the php code going inside the or die () part
    3 - I don't want to be spammed to death with an email every time a new visitor tries to open the website, so there MUST be a trick to only send a notification once in a while, for instance once every 60 minutes.

    For the point 3 :
    - I think a .txt file on the same hosting place would do the trick, the php code would edit it with a timestamp when it records a connexion failure, then it would proceed to sending the email, and stop at that.
    - When the php code is ran again by a new visitor trying in vain to connect, that php code would find the text file has been edited already with a failure report and a timestamp old of less than 60 minutes, so the php code would skip sending me a new email
    - when the php code is ran again and it finds that the text file has a failure timestamp older than 60 minutes, it erases it with a new failure record + date, and sends me an email

    I don't think coding this would be really complicated, however please correct me if I'm mistaken.

    Last note, I already posted a WTB about such a feature months ago, and it wasted my time for nothing : let's get to business, dear coders, and not waste dozens of PM replies for nothing, shall we ? ;) We'll talk through Digital Point's PMs, no ICQ, no Skype, no Google Voice, no bashing that you're super pro during 3 PM exchanges before talking business, no making offers based on a bloody cron job when I write it wasn't possible, don't lose my time as well as your own :)
     
    Last edited: Nov 19, 2011
    sabin, Nov 19, 2011 IP
  2. sabin

    sabin Well-Known Member

    Messages:
    114
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    130
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Update : OK the job has been taken and done :)
     
    sabin, Nov 19, 2011 IP