Skip to content

Instantly share code, notes, and snippets.

@ruledio
Created January 4, 2019 11:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ruledio/89b2342af5a55286c86b0fa5dc455898 to your computer and use it in GitHub Desktop.
Save ruledio/89b2342af5a55286c86b0fa5dc455898 to your computer and use it in GitHub Desktop.
Cloudways Disk Space Details/Quota Per Application
import subprocess
proc = subprocess.Popen("du -sh ./applications/* | sort -hr", shell=True, stdout=subprocess.PIPE)
for line in iter(proc.stdout.readline,''):
line = line.split()
size = line[0]
app_dir = line[1]
app_name = app_dir[15:]
app_conf = "/home/master/applications/%s/conf/server.apache" % (app_name)
real_name = subprocess.check_output(['tail', '-1', app_conf])
real_name = real_name.rsplit(None, 2)[-2]
print "%-8s %-8s %-8s" % (size,app_name,real_name )
@unaibamir
Copy link

Thanks mate. it helped me a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment