Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Updating of unRAID variables

Featured Replies

The way unRAID v6 updates its variables in the background is completely different from the old approach done in V5. Let me state first that the approach taken in V6 is a good one because it alleviates the burden on the system itself each time the webGUI is queried by the browser.

 

At the same time the new V6 implementation puts a limitation in place when the need arises to do real-time updates on selective page content. Such selective updates rely on $.ajax requests to pull information from the server without the need to do a complete page refresh. However unRAID's internal variables do not get updated any longer unless a complete page refresh is performed and as side effect real-time updates do not show any changes.

 

It would be a strength for unRAID to have the ability to do automatic real-time updates and not rely on pressing the "refresh" button each time to see the current state. Such a system is required too when a notification system is put in place.

 

We are changing the way unRaid "state" is obtained.

 

Previously this was done via "ini" files located in /var/local/emhttp/.  Each time a webGui page was accessed, emhttp would regenerate those files and then execute /usr/local/emhttp/plugins/webGui/template.php.  template.php would then use parse_ini_file() to read in unraid state.

 

We are moving to a socket-based solution.  When template.php executes, it will do something like this:

 

$s = fsockopen( "unix:///var/run/emhttp.sock");
fwrite($s, "cmdStatus=all\0");
$json = stream_get_contents($s);
extract(json_decode($json, true));

 

This change will appear after -beta10.

 

Eventually will probably implement a full json-rpc api to unraid services... thoughts?

  • Author

I like the idea to read files on socket based, this would help in making file updates only when requested/needed and thus keeping system load low.

 

Can you include the possibility to query and update selected files too? This would be useful when selective page updates are done (e.g. only the disks table).

 

Haven't made my mind up on json, though ...

 

  • 4 months later...

The way "plugin update" works is that it downloads the PLG file to /tmp directory.  Once download completes it executes 'plugin version' to get the version number and compares against installed version number.  The larger the PLG file, the longer this download can take (though admittedly it's probably negligible).

 

That's not what bonienl is talking about. The unRAID control process (called emhttp) creates a lot of data that are stored under "/var/local/emhttp/" directory and then passed to PHP scripts as variables, like $disks and $vars. In fact, emhttp puts together a lot of data that are difficult to harvest. But this have a caveat in v6: these files are only updated upon a page load/refresh, so scripts that relies on ajax post/get functions can only be reliable if the data they need is static, like the IP address, the temperatue scale etc...

 

  • 3 months later...

How do I access the $disks and $vars data inside my PHPs?

Do I need to load them from the files or are they already loaded in the PHP "cover code"?

 

How do I access the $disks and $vars data inside my PHPs?

Do I need to load them from the files or are they already loaded in the PHP "cover code"?

This would give you unRAID's ip address from $vars.

$ipaddr = $var['IPADDR'];

Edit: $disks would be $disks['parity']['id'] since its a multidimensional array.

Edit2: This is an example from the webgui ShareEdit.page

  $myDisks = array();
  foreach ($disks as $disk) $myDisks[] = $disk['name'];

And would give you an array $myDisks with the names of all the disks.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.