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

    Multiple /usr/sbin/cron instances in 2.1

    Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
    11 Posts 5 Posters 3.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.
    • C Offline
      ckraimer
      last edited by

      I use cron quite a bit and have had to write duplicate cron hunters into my scripts that are being launched because sometimes there will be 2 or 3 cron instances running and so the scripts will be launched multiple times simultaneously.  My scripts don't work as well for some unknown reason in 2.1.

      Has anyone had to deal with this problem?

      1 Reply Last reply Reply Quote 0
      • R Offline
        rjcrowder
        last edited by

        @ckraimer:

        I use cron quite a bit and have had to write duplicate cron hunters into my scripts that are being launched because sometimes there will be 2 or 3 cron instances running and so the scripts will be launched multiple times simultaneously.  My scripts don't work as well for some unknown reason in 2.1.

        Has anyone had to deal with this problem?

        Interesting you bring it up…. I had the same problem. I modified the code that writes the cron.sh startup script (/usr/local/etc/rc.d) to do a "killall cron" in the stop logic. I can't remember where the is located (might have been one of the ".inc" files).

        Anyway - that seems to have solved the problem.

        1 Reply Last reply Reply Quote 0
        • G Offline
          gusdvg
          last edited by

          I noticed something similar on one of my hosts, but it only appears to do it for dyndns checks:

          Oct  2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
          Oct  2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
          Oct  2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
          …

          Also, as I had set up notifications via email, I was getting three emails each time as for some reason the dyndns updater is not working correctly (manually its fine...).

          1 Reply Last reply Reply Quote 0
          • R Offline
            rjcrowder
            last edited by

            @gusdvg:

            I noticed something similar on one of my hosts, but it only appears to do it for dyndns checks:

            Oct  2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
            Oct  2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
            Oct  2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
            …

            Also, as I had set up notifications via email, I was getting three emails each time as for some reason the dyndns updater is not working correctly (manually its fine...).

            At least on my install, anything in the /etc/crontab file would execute once for each running cron process.

            1 Reply Last reply Reply Quote 0
            • jimpJ Offline
              jimp Rebel Alliance Developer Netgate
              last edited by

              I have noticed it as well, it is a side effect of having the Cron package installed. Its startup script (cron.sh) wasn't very good about making sure it didn't start multiple times.

              I checked in a fix, when you see the new version of cron show up, upgrade your package and it should behave better.

              Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

              1 Reply Last reply Reply Quote 0
              • R Offline
                rjcrowder
                last edited by

                The latest cron package doesn't solve the problem. It has a syntax error in the kill line (needs a space before the ']').

                BTW… after playing with it a little, I can confirm that the following stop line - placed in /usr/local/pkg/cron.inc - solves the problem...

                "stop" => "[ -f '/var/run/cron.pid' ] && /bin/kill -9 cat /var/run/cron.pid 2>/dev/null; rm -f /var/run/cron.pid;"

                1 Reply Last reply Reply Quote 0
                • jimpJ Offline
                  jimp Rebel Alliance Developer Netgate
                  last edited by

                  Not sure where you're seeing the bad spacing, in the file from the repo there is a space before the ]

                  Also the line you have isn't sufficient, it needs to kill all running copies of cron in addition to cleaning up the pid, as is done on the line there now.

                  I rm'd the cron.sh from my vm, reinstalled the pkg, and the syntax was correct/working.

                  Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                  Need help fast? Netgate Global Support!

                  Do not Chat/PM for help!

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    rjcrowder
                    last edited by

                    @jimp:

                    Not sure where you're seeing the bad spacing, in the file from the repo there is a space before the ]

                    Also the line you have isn't sufficient, it needs to kill all running copies of cron in addition to cleaning up the pid, as is done on the line there now.

                    I rm'd the cron.sh from my vm, reinstalled the pkg, and the syntax was correct/working.

                    Your absolutely correct on it not being sufficient… just figured that out. Not sure why mine didn't have the space, but I'll assume it was a PIBKAC error :-)

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      ckraimer
                      last edited by

                      I appreciate the fix.  As of today, it doesn't appear there is a new version of cron available.  Has it been released yet?

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        rjcrowder
                        last edited by

                        @ckraimer:

                        I appreciate the fix.  As of today, it doesn't appear there is a new version of cron available.  Has it been released yet?

                        It has been fixed since early October…

                        1 Reply Last reply Reply Quote 0
                        • P Offline
                          phil.davis
                          last edited by

                          @rjcrowder:

                          @ckraimer:

                          I appreciate the fix.  As of today, it doesn't appear there is a new version of cron available.  Has it been released yet?

                          It has been fixed since early October…

                          Cron package is at 0.1.8

                          As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                          If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

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