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

    cron job wont stop

    Scheduled Pinned Locked Moved General pfSense Questions
    16 Posts 4 Posters 872 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.
    • M
      michmoor LAYER 8 Rebel Alliance
      last edited by

      Using the pkg_check.php script seen in another forum post which checks for updated packages, i have it running just fine on one of my firewalls.
      On the second firewall the exact same script keeps executing every minute. I double checked the corn job to ensure its set the same way on the working one which it is so I'm sort of at a loss

      Working without issue.

      6bd5dfbc-5cf8-41c7-aca0-cf351883e7b4-image.png

      Working with issue
      fecede43-f6d7-4c79-9ecd-15fd0e1c5a5c-image.png

      I don't think it matters but the firewall working without issue is a 6100 and the one where the update script is running every minute is a 1100.

      Any ideas?

      Firewall: NetGate,Palo Alto-VM,Juniper SRX
      Routing: Juniper, Arista, Cisco
      Switching: Juniper, Arista, Cisco
      Wireless: Unifi, Aruba IAP
      JNCIP,CCNP Enterprise

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

        What does the actual crontab file look like?:

        [24.08-DEVELOPMENT][admin@4200.stevew.lan]/root: cat /etc/crontab 
        #
        # pfSense specific crontab entries
        # Created: August 28, 2024, 12:56 pm
        #
        SHELL=/bin/sh
        PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
        
        */1	*	*	*	*	root	/usr/sbin/newsyslog
        1	3	*	*	*	root	/etc/rc.periodic daily
        15	4	*	*	6	root	/etc/rc.periodic weekly
        30	5	1	*	*	root	/etc/rc.periodic monthly
        1,31	0-5	*	*	*	root	/usr/bin/nice -n20 adjkerntz -a
        1	3	1	*	*	root	/usr/bin/nice -n20 /etc/rc.update_bogons.sh
        1	1	*	*	*	root	/usr/bin/nice -n20 /etc/rc.dyndns.update
        */60	*	*	*	*	root	/usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot
        30	12	*	*	*	root	/usr/bin/nice -n20 /etc/rc.update_urltables
        1	0	*	*	*	root	/usr/bin/nice -n20 /etc/rc.update_pkg_metadata
        *	*	*	*	*	root	/usr/bin/nice -n20 /usr/local/bin/php /usr/local/sbin/acbupload.php
        */5	*	*	*	*	root	/usr/bin/nice -n20 /usr/local/bin/php -f /usr/local/pkg/snort/snort_check_cron_misc.inc
        #
        # DO NOT EDIT THIS FILE MANUALLY!
        # Use the cron package or create files in /etc/cron.d/.
        #
        
        M 1 Reply Last reply Reply Quote 0
        • J
          jrey @michmoor
          last edited by

          @michmoor said in cron job wont stop:

          update script is running every minute is a 1100.

          every minute? seems aggressive . more than once a day seems aggressive their won't be updates that often --

          10      12  *   *  *  blah
          

          min hour dayofmonth monthofyear dayofweek

          10th minute, in the 12th hour, every day of the month, every month of the year, ever day of the week.

          for example

          0  0 * * 0  blah
          

          run at midnight every sunday

          you can also do stuff like this

          30	0,2,4,6,8,10,12,14,16,18,20,22	   *	  *	*  blah
          

          so run on the 30th minute of every even hour (so every 2 hours) of every day

          etc.

          M 1 Reply Last reply Reply Quote 0
          • M
            michmoor LAYER 8 Rebel Alliance @stephenw10
            last edited by

            @stephenw10

            It looks good to me

            ]/root: cat /etc/crontab
            #
            # pfSense specific crontab entries
            # Created: August 27, 2024, 6:38 pm
            #
            SHELL=/bin/sh
            PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
            
            */1     *       *       *       *       root    /usr/sbin/newsyslog
            1       3       *       *       *       root    /etc/rc.periodic daily
            15      4       *       *       6       root    /etc/rc.periodic weekly
            30      5       1       *       *       root    /etc/rc.periodic monthly
            1,31    0-5     *       *       *       root    /usr/bin/nice -n20 adjkerntz -a
            1       3       1       *       *       root    /usr/bin/nice -n20 /etc/rc.update_bogons.sh
            1       1       *       *       *       root    /usr/bin/nice -n20 /etc/rc.dyndns.update
            */60    *       *       *       *       root    /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot
            30      12      *       *       *       root    /usr/bin/nice -n20 /etc/rc.update_urltables
            1       0       *       *       *       root    /usr/bin/nice -n20 /etc/rc.update_pkg_metadata
            16      3       *       *       *       root    /usr/local/pkg/acme/acme_command.sh "renewall" | /usr/bin/logger -t ACME 2>&1
            *       *       *       *       *       root    /usr/bin/nice -n20 /usr/local/bin/php /usr/local/sbin/acbupload.php
            0       8       *       *       5       root    /usr/local/bin/php /usr/local/www/pfblockerng/pfblockerng.php dcc >> /var/log/pfblockerng/extras.log 2>&1
            0       *       *       *       *       root    /usr/local/bin/php /usr/local/www/pfblockerng/pfblockerng.php cron >> /var/log/pfblockerng/pfblockerng.log 2>&1
            *       12      *       *       *       root    /usr/local/bin/php -q /root/pkg_check.php
            #
            # DO NOT EDIT THIS FILE MANUALLY!
            # Use the cron package or create files in /etc/cron.d/.
            #
            
            

            In case you think i was joking about the spam

            Aug 28 12:40:21 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:41:23 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:42:25 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:43:27 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK 
            Aug 28 12:44:29 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:45:32 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:46:34 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:47:36 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:48:38 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:49:40 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:50:42 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:51:44 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:52:17 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:53:19 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:54:21 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:55:23 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:56:25 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:57:28 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:58:30 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            Aug 28 12:59:32 790CCV-FW php-cgi[90234]: notify_monitor.php: Message sent to admin@xxxxxxxx.com OK
            
            

            Firewall: NetGate,Palo Alto-VM,Juniper SRX
            Routing: Juniper, Arista, Cisco
            Switching: Juniper, Arista, Cisco
            Wireless: Unifi, Aruba IAP
            JNCIP,CCNP Enterprise

            1 Reply Last reply Reply Quote 0
            • M
              michmoor LAYER 8 Rebel Alliance @jrey
              last edited by

              @jrey Its running every minute for some reason. Every 12hrs i have set up works fine for me.

              Firewall: NetGate,Palo Alto-VM,Juniper SRX
              Routing: Juniper, Arista, Cisco
              Switching: Juniper, Arista, Cisco
              Wireless: Unifi, Aruba IAP
              JNCIP,CCNP Enterprise

              J 1 Reply Last reply Reply Quote 0
              • J
                jrey @michmoor
                last edited by

                @michmoor

                because you have an * in the first position Every minute of the 12th hour of every day is that really what you want ?

                you likely want it to run 1 time so pick a minute in the 12th hour

                10 12 * * *

                on the 10th minute of the 12th hour of every day...

                if you want to run it twice a day.

                10 0,12 * * *

                the 10th minute of hour 0 and 12

                so run at
                00:10
                12:10

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

                  What are you trying to do there? You appear to have it set to run every minute in hour 12. And it looks to be doing that.

                  You probably want minute 1 of hour 12 like:
                  1 12 * * * root /usr/local/bin/php -q /root/pkg_check.php

                  M 1 Reply Last reply Reply Quote 1
                  • M
                    michmoor LAYER 8 Rebel Alliance @stephenw10
                    last edited by

                    @stephenw10 Ok i see the error.

                    Curious why the other firewall isn't firing off every minute as well. There are packages that need upgrading.

                    But good catch everyone. Thanks for pointing out the error to me.

                    Firewall: NetGate,Palo Alto-VM,Juniper SRX
                    Routing: Juniper, Arista, Cisco
                    Switching: Juniper, Arista, Cisco
                    Wireless: Unifi, Aruba IAP
                    JNCIP,CCNP Enterprise

                    J 1 Reply Last reply Reply Quote 0
                    • M
                      michmoor LAYER 8 Rebel Alliance @jrey
                      last edited by

                      @jrey said in cron job wont stop:

                      o run 1 time so pick a minute in the

                      Thats exactly the problem. Thanks @jrey

                      Firewall: NetGate,Palo Alto-VM,Juniper SRX
                      Routing: Juniper, Arista, Cisco
                      Switching: Juniper, Arista, Cisco
                      Wireless: Unifi, Aruba IAP
                      JNCIP,CCNP Enterprise

                      1 Reply Last reply Reply Quote 0
                      • J
                        jrey @michmoor
                        last edited by

                        @michmoor said in cron job wont stop:

                        Curious why the other firewall isn't firing off every minute as well

                        It likely is - as the cron settings are the same (so it runs fine, might be an illusion)

                        Not sure what the script is actually doing, since I don't use it - you want to share the link to it - I'll peek

                        but it could simply be a case that the 6100 has enough horse power to complete the task in under a minute and the 1100 does not. Lot's of factors and possibilies to consider -- when the jobs on the 1100 start colliding more bad things likely happen thus the "spam"

                        does the script actually log that it has run somewhere ?

                        M GertjanG 2 Replies Last reply Reply Quote 0
                        • M
                          michmoor LAYER 8 Rebel Alliance @jrey
                          last edited by

                          @jrey

                          The conversation is here. https://forum.netgate.com/topic/137707/auto-update-check-checks-for-updates-to-base-system-packages-and-sends-email-alerts/70

                          The script is here

                          https://gist.github.com/luckman212/5e69ecf04e000ace47eb8f760b71e160

                          Firewall: NetGate,Palo Alto-VM,Juniper SRX
                          Routing: Juniper, Arista, Cisco
                          Switching: Juniper, Arista, Cisco
                          Wireless: Unifi, Aruba IAP
                          JNCIP,CCNP Enterprise

                          J 1 Reply Last reply Reply Quote 0
                          • J
                            jrey @michmoor
                            last edited by

                            @michmoor

                            Yeah I actually just found it

                            Auto update check, checks for updates to base system + packages and sends email alerts:

                            look at the sample cron the author has there in the first post

                            1 18 * * * blah

                            Minute 1 of the 18th hour ..

                            Pick a minute and hour of you choice, run it once not 60 times in the hour, you'll be fine ... servers everywhere will be fine ... spam will stop all will be well.

                            On that post @stephenw10 said in Auto update check, checks for updates to base system + packages and sends email alerts:

                            Needs more blinkenlight action!

                            I don't think he meant once a minute for an hour.... ๐Ÿ˜Š

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              michmoor LAYER 8 Rebel Alliance @jrey
                              last edited by

                              @jrey lol

                              Firewall: NetGate,Palo Alto-VM,Juniper SRX
                              Routing: Juniper, Arista, Cisco
                              Switching: Juniper, Arista, Cisco
                              Wireless: Unifi, Aruba IAP
                              JNCIP,CCNP Enterprise

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

                                Blinkenlights. Always. ๐Ÿ˜‰

                                1 Reply Last reply Reply Quote 1
                                • GertjanG
                                  Gertjan @jrey
                                  last edited by

                                  @jrey said in cron job wont stop:

                                  does the script actually log that it has run somewhere ?

                                  If there was a cron log on pfsense, you would see that your 6100 also ran this script every minute.
                                  But on 6100 everything is up to date, so according to the script :

                                  84b22dc6-a496-4bc2-89a3-ab145b8e15d3-image.png

                                  No log lines
                                  No message line on the command interface - which is non interactive, so discarded.
                                  No message (mail in my case)

                                  so the system log doesn't show anything if up to date.

                                  No "help me" PM's please. Use the forum, the community will thank you.
                                  Edit : and where are the logs ??

                                  J 1 Reply Last reply Reply Quote 1
                                  • J
                                    jrey @Gertjan
                                    last edited by

                                    @Gertjan

                                    Good point - I never actually looked at the script referenced only the post that it was provided on. ๐Ÿ˜ but yes that is why it doesn't show as running on his 6100. It is.

                                    Fixing the cron timing so that it does not "Blinkenlights" so many times - should make everything happy on both systems. Only need 1 Blinkenlight in the hour. ๐Ÿคฃ

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