path: root/abs/core/LinHES-system
diff options
authorBritney Fransen <>2015-10-06 18:13:15 (GMT)
committerBritney Fransen <>2015-10-06 18:13:15 (GMT)
commite99bdd59503e594129d079904f7815c21dea8078 (patch)
tree87a1649683dba2eaeb2885315279cdd876c962f0 /abs/core/LinHES-system
parent9cea1a6c7df291d661803c339814536157227926 (diff)
LinHES-system: add option to check if Samba files are in use
Diffstat (limited to 'abs/core/LinHES-system')
2 files changed, 27 insertions, 3 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 014f235..cd87ee8 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
arch=('i686' 'x86_64')
pkgdesc="Everything that makes LinHES an automated system"
@@ -122,7 +122,7 @@ md5sums=('76842f8cff548d2c1289e0992a8b84dd'
- '69ecfe682f1b61c2c4c95d890b9f523c'
+ 'bc34ef7da85dd6228d15771cb2ecf870'
diff --git a/abs/core/LinHES-system/ b/abs/core/LinHES-system/
index 4575e7d..ddea479 100755
--- a/abs/core/LinHES-system/
+++ b/abs/core/LinHES-system/
@@ -201,6 +201,23 @@ def userlogins_check(cmdargs):
return True
+def sambafiles_check(cmdargs):
+ if (cmdargs.sambafiles):
+ u=False
+ msg(cmdargs," Checking if Samba files are in use...")
+ try:
+ smbstatus=subprocess.check_output(["smbstatus", "-L"])
+ except:
+ smbstatus="No locked files"
+ if "No locked files" in smbstatus:
+ msg(cmdargs," Samba files are NOT in use.")
+ return True
+ else:
+ msg(cmdargs," Samba files are in use.")
+ return False
+ else:
+ return True
def mythfe_check(cmdargs,cursor,mythDB):
#checks to see if a frontend is considered idle
# True means FE is idle
@@ -259,6 +276,7 @@ def usage():
determine if it is idle:
- (option -g) users are logged in return busy
ignores mythtv (:0) for busy
+ - (option -f) Samba files are in use return busy
- (option -l) mythshutdown is locked return busy
- (option -d) in a daily wake period or
about to start a daily wake period return busy
@@ -282,7 +300,8 @@ def usage():
def main(args=[False]):
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--daily', action='store_true', help='Include daily wake & about to start wake in system busy. (default: daily wake & about to start wake is system idle)')
- parser.add_argument('-g', '--logins', action='store_true', help='Include user logins in system busy. ignores mythtv (:0) in system busy.')
+ parser.add_argument('-g', '--logins', action='store_true', help='Include user logins in system busy. Ignores mythtv (:0) in system busy.')
+ parser.add_argument('-f', '--sambafiles', action='store_true', help='Include Samba files in use in system busy.')
parser.add_argument('-l', '--lock', action='store_true', help='Include mythshutdown lock in system busy. (default: mythshutdown lock is system idle)')
parser.add_argument('-r', '--runningfe', action='store_true', help='Include running mythfrontends in system busy. (default: running mythfrontends are system idle)')
parser.add_argument('-s', '--silent', action='store_true', help='Run without printing output. Recommended for use in cron jobs or scripts.')
@@ -303,6 +322,11 @@ def main(args=[False]):
idle = False
+ if (idle and sambafiles_check(cmdargs)):
+ idle = True
+ else:
+ idle = False
from MythTV import MythDB
mythDB = MythDB()