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

    Extending NUT package to work with multiple UPSs

    Scheduled Pinned Locked Moved pfSense Packages
    1 Posts 1 Posters 1.5k 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.
    • G
      grantjoy
      last edited by

      Hello,

      I am rewriting the pfsense NUT package to work with multiple UPSs. Everything is working, except deleting UPSs. The issue is that I need to reload NUT when a UPS is deleted, but as far as I can see there is no way to apply a delete action in the XML.

      I am using pkg.php and the <adddeleteeditpagefields>XML tag to create the add/modify/remove list of UPSs.

      Here is the code:
      pkg/nut.xml:                http://pastebin.com/f6qM2F87
      pkg/nut.inc:                  http://pastebin.com/MsYsvUWC
      www/status_nut.php :  http://pastebin.com/0Zbvbfdb

      What I need is for a sync_package() to happen on removal of a UPS, but I am constrained by using nut.xml. If there was a <custom_php_remove_command>that I could specify in nut.xml, I would just add:

      <custom_php_remove_command>sync_package_nut();</custom_php_remove_command>

      As a possible workaround for this problem, I am considering writing a new /www/ page with the table of UPSs which would look the same as pkg.php?xml=nut.xml, but I would be able add an action to the delete button.

      Is this a good solution? Is there a better way? Any advice is appreciated.</custom_php_remove_command></adddeleteeditpagefields>

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