Executing a php script at Midnight every day? HELP!

Discussion in 'Site & Server Administration' started by hugoalves, Oct 24, 2011.

  1. #1
    I want to execute a script php to reset a mysql table every day at 0h00.

    I tried to use CRON in Cpanel, but I don't know linux commands... :(


    Can somebody help me with this and with turning the script protected?



    Thanks, Hugo Alves.
     
    hugoalves, Oct 24, 2011 IP
  2. expertvm

    expertvm Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should create the mysql script that reset your database using PHP first. After which, you can set cron to execute the PHP script everyday.
     
    expertvm, Oct 30, 2011 IP
  3. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #3
    The cron syntax should be:

    0 0 * * * /usr/bin/php -f /home/USER/path/to/script.php
     
    zacharooni, Oct 31, 2011 IP
  4. amgadhs

    amgadhs Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can save yourself the trouble and just use Cronless to call the script for your automatically at midnight.
     
    amgadhs, Nov 1, 2011 IP
  5. theausums

    theausums Peon

    Messages:
    321
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Last edited: Nov 2, 2011
    theausums, Nov 2, 2011 IP
  6. Markwebuk

    Markwebuk Well-Known Member

    Messages:
    1,595
    Likes Received:
    17
    Best Answers:
    2
    Trophy Points:
    113
    #6
    Your webhost should assist you with your request. This is the main advantage of using hosting services from a Managed WebHost who can serve you with all your technical issues in a timely manner.
     
    Markwebuk, Nov 11, 2011 IP
  7. xengine

    xengine Greenhorn

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    You can use easycron.com, a super easy-to-use free cron job service.
     
    xengine, Jul 22, 2012 IP
  8. cesurasean

    cesurasean Active Member

    Messages:
    269
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #8
    Use a bash script, and run a cronjob to run it.
     
    cesurasean, Aug 1, 2012 IP