-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsize.py
More file actions
executable file
·54 lines (41 loc) · 1.54 KB
/
size.py
File metadata and controls
executable file
·54 lines (41 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
import sys
from subprocess import call
"""
TODO: add capability to check parent-child output
"""
sshname = "yoursshname" # replace with your login
if __name__ == "__main__":
# Check for parameters: first parameter should be a pod/cluster; subsequent parameters should be a list of installs
args = sys.argv
if len(args) < 3:
print "Usage: size [cluster] [install1] [install2] ..."
sys.exit(2)
execstr = "ssh -t %s@pod-%s.wpengine.com \"cd /nas/wp/www/sites; sudo du -shc" % (sshname, args[1])
for arg in args[2:]:
execstr += " " + arg
execstr += "\""
stgstr = "ssh -t %s@pod-%s.wpengine.com \"cd /nas/wp/www/staging; sudo du -shc" % (sshname, args[1])
for arg in args[2:]:
stgstr += " " + arg
stgstr += "\""
gitstr = "ssh -t %s@pod-%s.wpengine.com \"cd /nas/wp/www/sites; sudo du -shc" % (sshname, args[1])
for arg in args[2:]:
gitstr += " %s/.git" % (arg)
gitstr += "\""
wpepstr = "ssh -t %s@pod-%s.wpengine.com \"cd /nas/wp/www/sites; sudo du -shc" % (sshname, args[1])
for arg in args[2:]:
wpepstr += " %s/_wpeprivate" % (arg)
wpepstr += "\""
print "production sites:\n"
call(execstr, shell=True)
print "staging sites:\n"
call(stgstr, shell=True)
print "git size:\n"
call(gitstr, shell=True)
print "_wpeprivate size:\n"
call(wpepstr, shell=True)
"""
This is a one-liner to run from bash:
ourvar=$(sudo /nas/wp/ec2/cluster parent-child acctname); echo -e "du -shc "${ourvar}| bash
"""