php question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex79
    Confirmed User
    • Jun 2002
    • 996

    #1

    php question

    i have a php script (page) that i want to be executed at every 12/24 hours.. how can i do so the script to be automaticaly executed at a fixed date from the day?
  • UltraSonic
    Confirmed User
    • Jul 2004
    • 1728

    #2
    Unix/Linux servers can execute it for you every 12/24 hours, whatever you choose.
    Your Blend, Your Product

    Comment

    • nolaman
      Confirmed User
      • Mar 2004
      • 1001

      #3
      cron
      PHP Programmer ICQ 215-504-788

      Comment

      • alex79
        Confirmed User
        • Jun 2002
        • 996

        #4
        Originally posted by UltraSonic
        Unix/Linux servers can execute it for you every 12/24 hours, whatever you choose.
        how do i do that?

        let's say that the php script is located at /home/script.php
        can somebody explain me exactly what i have to do so the script.php to be automaticaly executed at a fixed hour each day?

        Comment

        • fishy
          Confirmed User
          • Jul 2004
          • 116

          #5
          Teach a monkey to type in the text, then give the monkey a big banana every 12/24 hours. Don't make it sign any agreements, don't know if it will agree to do that. I know these monkeys drive a hard bargain...

          MAILERS MAILERS: Need a hot product? Click to find out!"

          Comment

          • budz
            Disruptive Innovator
            • Sep 2003
            • 4230

            #6
            Originally posted by fishy
            Teach a monkey to type in the text, then give the monkey a big banana every 12/24 hours. Don't make it sign any agreements, don't know if it will agree to do that. I know these monkeys drive a hard bargain...
            lmao.
            C:\Code\
            C:\Code\Run\

            Comment

            • Calvinguy
              Confirmed User
              • Oct 2002
              • 1752

              #7
              Ask your host

              Comment

              • alex79
                Confirmed User
                • Jun 2002
                • 996

                #8
                Originally posted by Calvinguy
                Ask your host
                i'm on dedicated

                Comment

                • Manowar
                  jellyfish  
                  • Dec 2003
                  • 71528

                  #9
                  Originally posted by fishy
                  Teach a monkey to type in the text, then give the monkey a big banana every 12/24 hours. Don't make it sign any agreements, don't know if it will agree to do that. I know these monkeys drive a hard bargain...

                  Comment

                  • UltraSonic
                    Confirmed User
                    • Jul 2004
                    • 1728

                    #10
                    Originally posted by alex79
                    how do i do that?

                    let's say that the php script is located at /home/script.php
                    can somebody explain me exactly what i have to do so the script.php to be automaticaly executed at a fixed hour each day?
                    Make a cronjob that executes every 12/24 hours........ how to do it: RTFM (yahoo: +howto +cron) or install webmin.
                    Your Blend, Your Product

                    Comment

                    • Ash@phpFX
                      Confirmed User
                      • Nov 2003
                      • 4292

                      #11
                      make a cron job,

                      or hit f5 twice a day

                      Comment

                      • UltraSonic
                        Confirmed User
                        • Jul 2004
                        • 1728

                        #12
                        Maybe this helps:

                        Example Crontab:

                        # r----minute
                        # | r-----hour
                        # | | r------day of the month
                        # | | | r------month
                        # | | | | r------day of the week
                        # | | | | | |------ command to run ------------->
                        # | | | | | |
                        5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
                        # run five minutes after midnight, every day
                        15 14 1 * * $HOME/bin/monthly

                        # run at 2:15pm on the first of every month -- output mailed to paul
                        0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%

                        # print out the message at 4:05 every sunday.
                        5 4 * * sun echo "run at 5 after 4 every sunday"





                        If this file were saved as "paul.ct" then


                        crontab -u paul paul.ct

                        would be used to store the crontab for the user paul.

                        For more information:
                        man cron
                        man crontab
                        man 5 crontab


                        If it doesn't help..... back to yahoo and howtos
                        Your Blend, Your Product

                        Comment

                        • alex79
                          Confirmed User
                          • Jun 2002
                          • 996

                          #13
                          if i type this line from ssh
                          php /home/script.php > /dev/null
                          the script.php is executed

                          but if i write this line in crontab:

                          * * * * * php /home/script.php > /dev/null
                          or

                          30 7 * * * php /home/script.php > /dev/null

                          is not executed..
                          what can be the problem?

                          Comment

                          • Repetitive Monkey
                            Confirmed User
                            • Feb 2004
                            • 3505

                            #14
                            Use wget instead and specify the external address.

                            Comment

                            • UltraSonic
                              Confirmed User
                              • Jul 2004
                              • 1728

                              #15
                              Originally posted by alex79
                              if i type this line from ssh
                              php /home/script.php > /dev/null
                              the script.php is executed

                              but if i write this line in crontab:

                              * * * * * php /home/script.php > /dev/null
                              or

                              30 7 * * * php /home/script.php > /dev/null

                              is not executed..
                              what can be the problem?
                              Might be because you have to restart the crontab i think
                              Your Blend, Your Product

                              Comment

                              • Stramm
                                Confirmed User
                                • Jan 2003
                                • 342

                                #16
                                Originally posted by UltraSonic
                                Might be because you have to restart the crontab i think
                                restart crontab???? huh??


                                that works
                                30 1 * * * /usr/local/bin/wget --spider -q http://www.yourdomain.com/path/script.php >/dev/null 2>&1

                                the path top wget you can get with 'whereis wget' (SSH or telnet)

                                if it's htaccess/ htpasswd protected... then http://user:[email protected]/path/script.php ....

                                Comment

                                • rich06
                                  Registered User
                                  • May 2004
                                  • 20

                                  #17
                                  alex

                                  you shouldn't need to re-start cron -- it re-loads all crontab changes automatically.

                                  The reason your crontab entry didn't run was probably because cron couldn't find the php binary ... try again with the full path to your php binary e.g.

                                  * * * * * /usr/bin/php -q /home/script.php > /dev/null 2>&1

                                  hth
                                  rich
                                  Email: [email protected]

                                  Comment

                                  • arachnO
                                    Confirmed User
                                    • Jan 2004
                                    • 1327

                                    #18
                                    crontab is your solution...
                                    All news from Adult Industry: new sites, new galleries, updated sites, PPS days and much more!
                                    TrafficHolder.com - Buy/Sell Adult Traffic

                                    Comment

                                    Working...