Instantly share code, notes, and snippets.

Embed
What would you like to do?
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 )
@ruledio

This comment has been minimized.

Copy link
Owner

ruledio commented Jan 4, 2019

Cloudways Disk Space Details/Quota Per Application

Show disk usage per app, does not show MySQL DB size

Save this file inside /home/master and use as below:

python app-size.py

Output below:

1.2G  bdhvsjdgr    www.domain.co.uk
303M  xhhgwond     phpstack-00000-00000.cloudwaysapps.com 
175M  zfhehvbsdjd  www.domain.com
@unaibamir

This comment has been minimized.

Copy link

unaibamir commented Jan 9, 2019

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