Jump to content
We're Hiring! Full Stack Developer ×

dlandon

Community Developer
  • Posts

    10,285
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by dlandon

  1. unRAID V6 Plugins I started out asking how the plugin system works, and while implementing some plugins, I learned a lot about how it works. V6b8 has brought in a totally new plugin system compared to V5 that is more flexible, easier to use, and helps sort out the "What plugins do I have installed and what versions are they?" questions. While I don't profess to be an expert at the plugin system, I wanted to start a post to help those wanting to convert V5 plugins or author new plugins. If the plugins follow the proper structure, the plugin manager (plgman) can check for the latest version, update, and remove plugins cleanly while unRAID is on-line. There are some best practices to be followed with the new plgman. Install plugins in the "Install Extensions" field in the "Extensions" tab. Don't install plugins by putting then in the flash drive. Plgman needs to manage the plugin for proper operation. You can enter a URL or a plugin file on unRAID to install. Remove plugins through the plgman webpage. Use plgman to update plugins. I will use the ntfs-3g plugin I wrote for V6 as an example. It does not have a webpage in unRAID, but I'll go through what needs to be done so unRAID will understand how to use the webpage. Start off in your plug in with: <?xml version='1.0' standalone='yes'?> <!DOCTYPE PLUGIN [ <!ENTITY name "ntfs-3g"> <!ENTITY author "dlandon"> <!ENTITY version "2014.09.05"> <!ENTITY pluginURL "https://github.com/dlandon/unraid-snap/raw/master/ntfs-3g-x86_64.plg"> ]> <PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;"> The describes your plugin to the unRAID plgman. name - this is the name of you plugin. This name should be the sub-directory for you plugin off the /usr/local/emhttp/plugins/ directory and is where your plugin files are located. Plgman uses the name to find your plugin, and the icon associated with the plugin. The icon should be named 'name.png'. Plgman uses this information to display information about your plugin. author - Information field for plgman to display. version - Plgman displays the version and uses this version to check for an updated version in your repository. The convention is year.month.day. If several releases occur in the same day, use the convention year.month.day-x, where x-=1,2,... pluginURL - The is the web URL to the repository where your plugin is stored. Plgman uses it to look for the latest version of your plugin. It is best to use a generic name for your plugin and not have the name include a version. The versioning is done inside the plugin. <!-- 2013-10-19 - first release 2014-01-24 - Modified for unRAID 6 (64 bit) The plugin provides ntfs-3g support for unRAID systems. --> It is a good idea to include some comments or further information about the plugin. This would be a good place for a license. <FILE Name="/boot/packages/ntfs-3g-2013.1.13-x86_64-1.txz" Run="upgradepkg --install-new"> <URL>http://slackware.oregonstate.edu/slackware64-14.1/slackware64/a/ntfs-3g-2013.1.13-x86_64-1.txz</URL> <MD5>de646f44d881b6c4292e353b717792cd</MD5> </FILE> This is the ntfs-3g package that is installed. This could be a tar bundle that you expand into the the /usr/local/enhttp/plugins/name. If you download a tar bundle, store a copy on the flash at /boot/config/plugins/name so it doesn't have to be downloaded each time the plugin is installed. Packages are stored on the flash at /boot/packages. <FILE Name="/boot/config/plugins/&name;/ntfs-3g.png"> <URL>https://github.com/dlandon/unraid-snap/raw/master/ntfs-3g.png</URL> </FILE> This is the icon used for the ntfs-3g plugin. I would recommend that you put this into the bundle for the plugin structure you download if possible. <FILE Name="/usr/local/emhttp/plugins/&name;/ntfs-3g.png"> <LOCAL>/boot/config/plugins/&name;/ntfs-3g.png</LOCAL> </FILE> This does nothing more than make a copy of the stored ntfs-3fg icon on the flash drive into the plugin file structure. <!-- Page file --> <FILE Name="/usr/local/emhttp/plugins/&name;/Apcupsd.page"> <INLINE> <![CDATA[ Menu="OtherSettings" Icon="apcupsd.png" Version="2014.09.06" Author="SeeDrs" Title="APC UPS" --- <?php php goes here. ?> ]]> </INLINE> </FILE> Plugin Page File The page file is used by emhttp to display and render your webpage. The page file must begin with a capital letter, and your php included in the page file. This is the page file from the Apcupsd plugin as an example. The 'Menu' setting is important because this is the area in 'Settings' where emhttp will install the icon. <!-- create plugin README.md file --> <FILE Name="/usr/local/emhttp/plugins/&name;/README.md"> <INLINE> **NTFS-3G Package** The ntfs-3g driver package is needed for writing on NTFS formated disks. The built in NTFS driver is read only. </INLINE> </FILE> README File The READ.me is used by plgman to dispay in the plugin webage. Use it to describe your plugin. Again, I recommend that you put this file in your tar bundle if it is possible to save this step. Remove Method <!-- The 'remove' script. --> <FILE Run="/bin/bash" Method="remove"> <INLINE> rm /boot/packages/ntfs-3g-2013.1.13-x86_64-1.txz removepkg &name; rm -r /usr/local/emhttp/plugins/&name; rm -r /boot/config/plugins/&name; </INLINE> </FILE> </PLUGIN> This is the remove script executed when plgman is asked to remove the plugin. Do any package removal and clean up necessary to remove all traces of the plugin. There are some cli commands that you can use for development and testing of your plugin: plugin install - Install the plugin. plugin delete name - This is how you remove a plugin. The 'name' is the name of your plugin. plugin update name - This will update your plugin. If you have made changes to the plugin, this will re-install the plugin with your changes. This is how plgman does a plugin update. It downloads the new plugin first, then runs the update. plugin check name - Check for a new version of your plugin. I know this is not complete and I would like input from Tom or Jonp if there is anything I need to correct/add. I would rather them spend time on the core functionality at this point and not spend their time on documentation. UPDATE: V6 beta11 has depricated 'category'. It is no longer used. The emhttp file structure in beta 12 has been changed. You can no longer have a .page file with a separate .php file of the same name. Your php is expected in the .page file. The php is separated in the .page file with '---'. The following is a work around to this limitation. This is the Snap.page from the updated snap plugin. Menu="OtherSettings" Icon="snap.png" Version="6.04" Author="Queeg/dlandon" Title="SNAP" --- <?php shell_exec('php /usr/local/emhttp/plugins/snap/Snap.php'); ?> Dynamix V6b12 incorporated dynamix as the default webgui. Dynamix has a process status indicator built into every plugin webpage you can use. This is how I did it in the apcupsd plugin: $sName = "apcupsd"; <script> $(function() { showStatus('<?=$sName?>'); }); </script> Dynamix checks for the existence of the pid file 'apcupsd.pid' and shows 'Running' if it exists, and 'Stopped' if it is not found. You should incorporate this indicator to be consistent with other dynamix web pages. This should be put at a place in your page refresh where the pid status would be valid. Notifications v6b12 now has an email and webgui notification system. /usr/local/sbin/notify -e "title of the message" -s "subject of the message" -d "additional information" -i "normal" The -i parameter specificies the importance level: normal, warning or alert Tabbed Menu Dynamix has rhe ability to use a tabbed system for plugins. The following is from the apcupsd plugin: Acpupsd.page Menu="OtherSettings" Title="APC UPS" Type="xmenu" Icon="apcupsd.png" Tabs="true" --- ApcupsdSettings.page u="Apcupsd:1" Title="UPS Settings" --- <?PHP ApcupsdStatus.page Menu="Apcupsd:2" Title="UPS Status" --- <?PHP Changelog A changelog can be displayed after the check for updates. Add the following to the plugin to display the changelog: <CHANGES> ###2014-12-07 - Made a change - Made another change </CHANGES>
  2. +1 I restore vintage tube radios. What a waste of a really nice radio.
  3. There is an issue with the CPU and MB temperatures. This line in the SystemTemps.php sorts the temperatures and the lowest one always shows first (left position) on the webpage. exec("sensors -A|awk '/^CPU Temp/ {print $3*1}; /^M\/?B Temp/ {print $3*1}'",$temp); No matter which temperature is associated with the CPU and MB, the lowest temperature will always show first on the left. In my case the MB temp is lower so it shows in the CPU temperature position. Really a minor issue, but may cause some consternation when trying to get the temperatures to show in the correct positions.
  4. There is a new version of powerdown that can help with the start and stop process. Powerdown is installed by Dynamix, and the apcupsd plugin. The apcupsd plugin for V6 has not been updated yet, but it's a simple matter to change the one you have to install the latest powerdown package. You can also install powerdown as a stand alone plugin. This post http://lime-technology.com/forum/index.php?topic=31735.0 describes how it works.
  5. That is the latest version. Joe didn't change the version message in the script.
  6. Joe, I don't see this as an unraid issue. I don't think I am making myself clear. Let me try again. You have logic in the cache_dirs script to stop caching when 'mover' is running. I don't believe that logic is stopping the caching in my situation. Whenever cache_dirs is running on my setup and the 'mover' script runs, I get the "duplicate object" log entries. I get them at night when 'mover' runs, and I get them also when I execute 'mover' manually. If I stop cache_dirs (cache_dirs -q), the log entries stop when 'mover' runs. Is there anything I can do to troubleshoot this?
  7. If I read you correctly, you are saying that I actually have duplicate objects? As far as I know I don't. I ran a dupe check and came up with nothing. These log entries only come up when "mover" is running. I stopped cache_dirs yesterday because I am running a pre_clear on a new disk. I stopped it because I didn't want to slow down the pre_clear. Last night I did not get any "duplicate objects" when mover was running. As a side note, I have 8Gb of memory. I don't know if this means anything.
  8. I am getting the "duplicate objects" log entries whenever mover is running. As a test I stopped cache_dirs and ran the mover manually and did not get the "duplicate object" log entries. I can't say for sure that cache_dirs is causing these entries, but it looks to be the cuplrit. Is there a way to confirm this? If so, then what steps can I take to stop the log entries? I have checked and I am running the latest version of cache_dirs. There are a lot of these log entries at night when the mover is running. Seems like a lot of needless entries in the log.
×
×
  • Create New...