KJThaDon Posted May 5, 2020 Share Posted May 5, 2020 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 ] ); } ?> Quote Link to comment
Squid Posted May 6, 2020 Share Posted May 6, 2020 First off, /mnt/cache doesn't exist remotely and you'd have to do it via an smb share Quote Link to comment
KJThaDon Posted May 8, 2020 Author Share Posted May 8, 2020 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 Quote Link to comment
KJThaDon Posted May 16, 2020 Author Share Posted May 16, 2020 Anyone have any ideas? Just want to be able to pull my share size spaced used and remaining.. Quote Link to comment
KJThaDon Posted May 16, 2020 Author Share Posted May 16, 2020 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 Quote Link to comment
Squid Posted May 16, 2020 Share Posted May 16, 2020 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. 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.