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

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

    Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
    87 Posts 22 Posters 25.9k 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.
    • D
      DominikHoffmann @luckman212
      last edited by

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

      I'm in the process of upgrading my systems to 23.09.1 and will update this script shortly (if it's possible) to handle the new update mechanism.

      Hi! Did you ever get around to updating your script?

      D 1 Reply Last reply Reply Quote 0
      • JonathanLeeJ
        JonathanLee
        last edited by

        What a gem of a thread!!!

        Make sure to upvote

        1 Reply Last reply Reply Quote 0
        • JonathanLeeJ
          JonathanLee @luckman212
          last edited by

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

          /usr/local/bin/php -q /root/pkg_check.php

          Thank you

          Make sure to upvote

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

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

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

            /usr/local/bin/php -q /root/pkg_check.php

            Thank you

            That's the command you paste into a cron task.

            99fd6a4a-7257-466b-bbeb-650b2b1897bd-image.png

            "cron" itself is a pfSense package :

            601b4be5-844c-40ff-84ca-40abd0c2cb52-image.png

            it permits you to show the already present cron tasks, and add your own.

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

            JonathanLeeJ 1 Reply Last reply Reply Quote 1
            • GertjanG Gertjan referenced this topic on
            • JonathanLeeJ
              JonathanLee @Gertjan
              last edited by

              @Gertjan :) first message

              Screenshot 2024-07-18 at 11.12.03.png

              Make sure to upvote

              1 Reply Last reply Reply Quote 1
              • JonathanLeeJ JonathanLee referenced this topic on
              • provelsP provels referenced this topic on
              • wgstarksW wgstarks referenced this topic on
              • slmS
                slm @luckman212
                last edited by

                @luckman212 Confirmed that if you change notify_via_smtp($msg); to notify_all_remote($msg); it will pick up the configuration of Slack and send the notification $msg property to Slack as well.

                infra-alerts (Channel) - Lâmôlabs - Slack 2024-08-04 11-37-47.png

                slmS 1 Reply Last reply Reply Quote 0
                • slmS
                  slm @slm
                  last edited by

                  Incidentally...

                  WRT the Slack Bot/App setup I followed the example shown here - Slack Bot OAuth Access Token, and merely copied the Slack details into the Slack section under Systems -> Advanced -> Notifications. For the API Key it's the xoxb-... key for the Slack app.

                  1 Reply Last reply Reply Quote 0
                  • GertjanG Gertjan referenced this topic on
                  • D
                    dereitz @DominikHoffmann
                    last edited by

                    @DominikHoffmann not sure if you've tried the existing script, but it works as is with email. No changes required for me. Cheers!

                    1 Reply Last reply Reply Quote 0
                    • wgstarksW
                      wgstarks
                      last edited by

                      Should this script also send notifications for package updates? I noticed a few days ago that I had several package updates waiting to be installed but never got a notification. I used to get them but I believe Netgate has made some changes to Package Manager so not sure if its possible to get notifications anymore regarding updates?

                      Box: SG-4200

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

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

                        Should this script also send notifications for package updates?

                        Both pfSense packages, visible under System > Package Manage r>Installed Packages and non pfSense 'FreeBSD) packages (from the Netgate / pfSense repository) will send you a message / notification / mail.

                        Examples of both are shown above. Check out what @slm and @JonathanLee showed.

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

                        wgstarksW 1 Reply Last reply Reply Quote 1
                        • wgstarksW
                          wgstarks @Gertjan
                          last edited by

                          @Gertjan
                          I think I need another cup of coffee this morning.😁
                          The post should have said system patches not packages. Should I get notifications for new system patches?

                          Box: SG-4200

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

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

                            Should I get notifications for new system patches?

                            When new patches for the "System_Patches" are created, they are included in the "System_Patches" pfSense package. This will bump the version number. You see this as a new package, "System_Patches" avaible for you.

                            Upgrade it, and have a look at the new patch or patches, and apply that interest you, or, by default, apply them all.

                            c9b34a12-f2f0-4329-9190-924eef73e200-image.png

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

                            wgstarksW 1 Reply Last reply Reply Quote 2
                            • wgstarksW
                              wgstarks @Gertjan
                              last edited by

                              @Gertjan
                              Looks like I need to do some troubleshooting when I get home. When I try to run the command

                              /usr/local/bin/php -q /root/pkg_check.php
                              

                              I get this-

                              Could not open input file: /root/pkg_check.php
                              

                              Box: SG-4200

                              provelsP 1 Reply Last reply Reply Quote 1
                              • provelsP
                                provels @wgstarks
                                last edited by

                                @wgstarks Permissions?
                                8755598b-9765-4f8c-a314-005bf611f760-image.png

                                Peder

                                MAIN - pfSense+ 24.11-RELEASE - Adlink MXE-5401, i7, 16 GB RAM, 64 GB SSD. 500 GB HDD for SyslogNG
                                BACKUP - pfSense+ 23.01-RELEASE - Hyper-V Virtual Machine, Gen 1, 2 v-CPUs, 3 GB RAM, 8GB VHDX (Dynamic)

                                wgstarksW 1 Reply Last reply Reply Quote 1
                                • wgstarksW
                                  wgstarks @provels
                                  last edited by

                                  @provels
                                  Actually it was missing completely. After upgrading from a 3100 to my 4200 many (or maybe all) packages were missing so it's not surprising that this script was also missing. Re-created it with the permissions you showed and all is working now.
                                  Thanks

                                  Box: SG-4200

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

                                    That's not a pfSense package so it won't be added when restoring a config unless you've used the filer pkg.

                                    wgstarksW M 3 Replies Last reply Reply Quote 0
                                    • provelsP provels referenced this topic on
                                    • wgstarksW
                                      wgstarks @stephenw10
                                      last edited by

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

                                      That's not a pfSense package so it won't be added when restoring a config unless you've used the filer pkg.

                                      Thanks. The filer package looks like it could be useful. I’ll have to install it and give it a try.

                                      Box: SG-4200

                                      1 Reply Last reply Reply Quote 0
                                      • wgstarksW wgstarks referenced this topic on
                                      • MarinSNBM
                                        MarinSNB
                                        last edited by

                                        To clarify, if there are no updates to any of the packages, does this script still send an email at the times as specified in your cron job? Thanks!

                                        Netgate 6100 Max pfSense+
                                        —>Unifi Aggregation/24 Pro PoE/24 PoE Enterprise switches
                                        —> UCK2+
                                        —> 3x U6E APs

                                        wgstarksW GertjanG 2 Replies Last reply Reply Quote 0
                                        • wgstarksW
                                          wgstarks @MarinSNB
                                          last edited by

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

                                          To clarify, if there are no updates to any of the packages, does this script still send an email at the times as specified in your cron job? Thanks!

                                          No. At least not in my case. I only get an email when an update exists.

                                          Box: SG-4200

                                          MarinSNBM 1 Reply Last reply Reply Quote 0
                                          • wgstarksW
                                            wgstarks @stephenw10
                                            last edited by wgstarks

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

                                            That's not a pfSense package so it won't be added when restoring a config unless you've used the filer pkg.

                                            This question is way off topic for this thread (apologies) but since it looks like the filer pkg docs have been removed from pfsense docs perhaps you can tell me how to use filer to modify what is backed up by the auto config backup? I see a sync tab but the help link just links back to the full pfsense docs.

                                            Box: SG-4200

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