added sudo

This commit is contained in:
Daniel 2019-09-16 21:29:33 +02:00
parent 187f437988
commit 2912bcc358
3 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import subprocess
def autoclean(path):
# remove all files older than 180 days
find = subprocess.Popen([
"find \"" + path +
"sudo find \"" + path +
"\" -type f -mtime +180 -delete -exec echo {} \\;"
],
stdout=subprocess.PIPE,

View file

@ -8,7 +8,7 @@ import subprocess
def get_space(label):
lines = list()
btrfs_usage = subprocess.Popen(
["btrfs fi usage -b -T " + label],
["sudo btrfs fi usage -b -T " + label],
stdout=subprocess.PIPE,
shell=True,
universal_newlines=True)
@ -35,7 +35,7 @@ def get_space(label):
def get_raid(label):
lines = list()
btrfs_usage = subprocess.Popen(
["btrfs fi usage -T " + label],
["sudo btrfs fi usage -T " + label],
stdout=subprocess.PIPE,
shell=True,
universal_newlines=True)

View file

@ -11,7 +11,7 @@ def get_all_drives():
]
lsblk = subprocess.Popen(
["lsblk -I 8 -d -b -o NAME,MODEL,SERIAL,SIZE,ROTA,RM,HOTPLUG"],
["sudo lsblk -I 8 -d -b -o NAME,MODEL,SERIAL,SIZE,ROTA,RM,HOTPLUG"],
stdout=subprocess.PIPE,
shell=True,
universal_newlines=True)
@ -46,7 +46,7 @@ def get_all_drives():
def get_smart(device):
passed = False
smartctl = subprocess.Popen(["smartctl -H " + device],
smartctl = subprocess.Popen(["sudo smartctl -H " + device],
stdout=subprocess.PIPE,
shell=True,
universal_newlines=True)
@ -69,7 +69,7 @@ def part_for_disk(device):
keys = ['name', 'label', 'fs', 'size', 'uuid', 'mount']
device = "/dev/" + device
lsblk = subprocess.Popen(
["lsblk " + device + " -l -b -o NAME,LABEL,FSTYPE,SIZE,UUID,MOUNTPOINT"],
["sudo lsblk " + device + " -l -b -o NAME,LABEL,FSTYPE,SIZE,UUID,MOUNTPOINT"],
stdout=subprocess.PIPE,
shell=True,
universal_newlines=True)