summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2015-10-06 18:13:15 (GMT)
committerBritney Fransen <brfransen@gmail.com>2015-10-06 18:13:15 (GMT)
commite99bdd59503e594129d079904f7815c21dea8078 (patch)
tree87a1649683dba2eaeb2885315279cdd876c962f0 /abs/core/LinHES-system
parent9cea1a6c7df291d661803c339814536157227926 (diff)
downloadlinhes_pkgbuild-e99bdd59503e594129d079904f7815c21dea8078.zip
linhes_pkgbuild-e99bdd59503e594129d079904f7815c21dea8078.tar.gz
linhes_pkgbuild-e99bdd59503e594129d079904f7815c21dea8078.tar.bz2
LinHES-system: idle.py: add option to check if Samba files are in use
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-xabs/core/LinHES-system/PKGBUILD4
-rwxr-xr-xabs/core/LinHES-system/idle.py26
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 @@
pkgname=LinHES-system
pkgver=8.3
-pkgrel=15
+pkgrel=16
arch=('i686' 'x86_64')
install=system.install
pkgdesc="Everything that makes LinHES an automated system"
@@ -122,7 +122,7 @@ md5sums=('76842f8cff548d2c1289e0992a8b84dd'
'8b0298f70f97cc1dc2a58b9a73c64bd3'
'716710e0db42147b079c9ec1c7080efa'
'cd28dd67a78f3b7da704e31db0298916'
- '69ecfe682f1b61c2c4c95d890b9f523c'
+ 'bc34ef7da85dd6228d15771cb2ecf870'
'a94fe6d980f4b810f2e2ae5352084b39'
'384956b4fd9bf40907856bab0e67b169'
'f4ce577e2ab1b6dbf9def46a8ab86e2d'
diff --git a/abs/core/LinHES-system/idle.py b/abs/core/LinHES-system/idle.py
index 4575e7d..ddea479 100755
--- a/abs/core/LinHES-system/idle.py
+++ b/abs/core/LinHES-system/idle.py
@@ -201,6 +201,23 @@ def userlogins_check(cmdargs):
else:
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]):
else:
idle = False
+ if (idle and sambafiles_check(cmdargs)):
+ idle = True
+ else:
+ idle = False
+
try:
from MythTV import MythDB
mythDB = MythDB()