From 2912bcc3585d15eea78626a022a0eef5c029cac9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 16 Sep 2019 21:29:33 +0200 Subject: [PATCH] added sudo --- dirkules/hardware/autoclean.py | 2 +- dirkules/hardware/btrfsTools.py | 4 ++-- dirkules/hardware/drive.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dirkules/hardware/autoclean.py b/dirkules/hardware/autoclean.py index 2439f6f..9dcc46e 100644 --- a/dirkules/hardware/autoclean.py +++ b/dirkules/hardware/autoclean.py @@ -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, diff --git a/dirkules/hardware/btrfsTools.py b/dirkules/hardware/btrfsTools.py index 8d2a14e..00843b5 100644 --- a/dirkules/hardware/btrfsTools.py +++ b/dirkules/hardware/btrfsTools.py @@ -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) diff --git a/dirkules/hardware/drive.py b/dirkules/hardware/drive.py index 0c9194b..125acf0 100644 --- a/dirkules/hardware/drive.py +++ b/dirkules/hardware/drive.py @@ -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)