Hello all,
here is my diskspace plugin modification to support a Multi-User environment with Linux Quota.
I don't know if is the proper way to do this, but is my first try.
1 ) Linux user need a quota.
2 ) ruTorrent & diskspace plugin need a modification.
* /var/www/rutorrent/conf/users/xxx/config.php
Add this line with the linux username.
Code: [Select]
$quotaUser = 'xxx';
* /var/www/rutorrent/plugins/diskspace/action.php
Execute the modification if quotaUser exist, else use the original diskspace plugin.
Code:
<?php
require_once( '../../php/util.php' );
if (isset($quotaUser)) {
cachedEcho('{ total: '.shell_exec("/usr/sbin/repquota -u /home | grep ^".$quotaUser." | awk '{print \$4*1024}'").', free: '.shell_exec("/usr/sbin/repquota -u /home | grep ^".$quotaUser." | awk '{print (\$4-\$3)*1024}'").' }',"application/json");
} else {
cachedEcho('{ total: '.disk_total_space($topDirectory).', free: '.disk_free_space($topDirectory).' }',"application/json");
}
?>
have fun and thank sam.
here is my diskspace plugin modification to support a Multi-User environment with Linux Quota.
I don't know if is the proper way to do this, but is my first try.
1 ) Linux user need a quota.
2 ) ruTorrent & diskspace plugin need a modification.
* /var/www/rutorrent/conf/users/xxx/config.php
Add this line with the linux username.
Code: [Select]
$quotaUser = 'xxx';
* /var/www/rutorrent/plugins/diskspace/action.php
Execute the modification if quotaUser exist, else use the original diskspace plugin.
Code:
<?php
require_once( '../../php/util.php' );
if (isset($quotaUser)) {
cachedEcho('{ total: '.shell_exec("/usr/sbin/repquota -u /home | grep ^".$quotaUser." | awk '{print \$4*1024}'").', free: '.shell_exec("/usr/sbin/repquota -u /home | grep ^".$quotaUser." | awk '{print (\$4-\$3)*1024}'").' }',"application/json");
} else {
cachedEcho('{ total: '.disk_total_space($topDirectory).', free: '.disk_free_space($topDirectory).' }',"application/json");
}
?>
have fun and thank sam.