#!/usr/bin/perl -w # contributed by Dominic Rivera $idisk_volume = '/usr'; my $output = `df $idisk_volume`; $output = (split('\n',$output))[1]; my ( $total_disk_size, $used_bytes ) = (split(' ',$output))[1,2]; $total_disk_size *= 1024; $used_bytes *= 1024; print <){ if ( /username\s+=\s+(.*?)\;/ ){ $username = $1;; } } # Find the total size and the used size of the volume /idisk/{username} my $output = `df /idisk/$username`; $output = (split('\n',$output))[1]; my ( $total_disk_size, $used_bytes ) = (split(' ',$output))[1,2]; $total_disk_size *= 1024; $used_bytes *= 1024; print "Content-type: text/plain\n"; print "\n"; print "{\n"; print " payload = {\n"; print " guestReadEnabled = Y;\n"; print " guestWriteEnabled = N;\n"; print " hasGeneralPassword = N;\n"; print " iDiskQuotaInBytes = $total_disk_size;\n"; print " iDiskUsedBytes = $used_bytes;\n"; print " relativePath = Public;\n"; print " };\n"; print " statusCode = success;\n"; print "}\n";