Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    PHP/Cron related question…. plz help

    Scheduled Pinned Locked Moved General pfSense Questions
    8 Posts 3 Posters 2.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      Zasa
      last edited by

      Hi

      I made an small php script what parses squid logs for me and sends the data via an ssh2 connection to an mysql server….

      everything works nice so far, the only problem i have is i cant run the php script via an cron job....

      i tried....

      1 php -q /testfolder/test.php
      2 fetch /testfolder/test.php
      3 sh /testfolder/run.sh

      the /testfolder/ is located in my root directory

      it would be really nice if someone could help me out with this problem.....

      sorry for my bad english

      Zasa

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        Try calling php with the full path:

        
        /usr/local/bin/php -f /testfolder/test.php
        
        

        Steve

        1 Reply Last reply Reply Quote 0
        • marcellocM
          marcelloc
          last edited by

          Schedulle it using cron package and don't forget the full path just like stephenw10 said.

          Some debugs to text files may help you finding out What is wrong.

          Treinamentos de Elite: http://sys-squad.com

          Help a community developer! ;D

          1 Reply Last reply Reply Quote 0
          • Z
            Zasa
            last edited by

            hi again :)

            thanks for your help… i sheduled it using the cron pakage but it still doesnt work,

            it looks like this now

            5   *   *   *   *   root   /usr/bin/php -f /test/a.php

            the cron pakage works (i tested it with an simple "reboot"), i also can start the php manualy just not with an cron job...

            i ever made an similiar script on linux and there i got it running with "wget /testfolder/test.php" but i cant install wget on my router and fetch doesnt seem to work....

            thanks again for your help...

            zasa

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              You can install wget if you need it but I doubt it will help:

              
              pkg_add -r ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-8.1-release/All/wget-1.12_1.tbz
              
              

              Anyway you seem to calling php from the wrong directory, it's in /usr/local/bin.

              Steve

              1 Reply Last reply Reply Quote 0
              • Z
                Zasa
                last edited by

                @stephenw10:

                You can install wget if you need it but I doubt it will help:

                
                pkg_add -r ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-8.1-release/All/wget-1.12_1.tbz
                
                

                Anyway you seem to calling php from the wrong directory, it's in /usr/local/bin.

                Steve

                hi steve

                it works!! the problem was like you said that i called it from the wrong directory… i changed it and now it works :):)

                thanks for you help :):) i own u one

                Zasa

                1 Reply Last reply Reply Quote 0
                • marcellocM
                  marcelloc
                  last edited by

                  Your cron job is scheduled to run every hour at minute 5.

                  If What you need it every five minutes, change first value from 5 to */5

                  Treinamentos de Elite: http://sys-squad.com

                  Help a community developer! ;D

                  1 Reply Last reply Reply Quote 0
                  • Z
                    Zasa
                    last edited by

                    @marcelloc:

                    Your cron job is scheduled to run every hour at minute 5.

                    If What you need it every five minutes, change first value from 5 to */5

                    Hi

                    i set it to */5 just i didnt copy the whole line of text :)

                    Zasa :)

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.