May 5, 20206 yr Looking to run some code on an external host to calculate my local unraid disk size etc. This is some code I've done in PHP, however I do not think it's possible to do this remotely with this technique. Anyone have any ideas or suggestions? <?php $dt = disk_total_space( '/mnt/cache' ); $df = disk_free_space( '/mnt/cache' ); $du = $dt - $df; $dp = sprintf( '%.2f', ( $du / $dt ) * 100 ); $df = formatSize( $df ); $du = formatSize( $du ); $dt = formatSize( $dt ); function formatSize( $bytes ) { $types = array( 'B', 'KB', 'MB', 'GB', 'TB' ); for ( $i = 0; $bytes >= 1024 && $i < ( count( $types ) - 1 ); $bytes /= 1024, $i++ ); return ( round( $bytes, 2 ) . " " . $types[ $i ] ); } ?>
May 6, 20206 yr First off, /mnt/cache doesn't exist remotely and you'd have to do it via an smb share
May 8, 20206 yr Author On 5/6/2020 at 7:06 AM, Squid said: First off, /mnt/cache doesn't exist remotely and you'd have to do it via an smb share Yes, I understand that. It was just an example because I am almost certain using that PHP code it does not pull external values. Anyone have any idea how to pull those values remotely? Also maybe like uptime counter? Thanks
May 16, 20206 yr Author Anyone have any ideas? Just want to be able to pull my share size spaced used and remaining..
May 16, 20206 yr Author Ok, so I can do it directly on the server instead of remotely. I already have a reverse proxy setup with nginx and php functioning, however it does not seem to be able to access /mnt/user/SHARE for calculations? What can I do to get the permissions right? Thanks
May 16, 20206 yr If you're running this as a container, then you would have to add in appropriate path mappings to access /mnt/user from within the container.
Archived
This topic is now archived and is closed to further replies.