diff options
Diffstat (limited to 'abs/core/LinHES-system/idle.py')
-rwxr-xr-x | abs/core/LinHES-system/idle.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/abs/core/LinHES-system/idle.py b/abs/core/LinHES-system/idle.py index 4575e7d..05dedac 100755 --- a/abs/core/LinHES-system/idle.py +++ b/abs/core/LinHES-system/idle.py @@ -201,6 +201,22 @@ def userlogins_check(cmdargs): else: return True +def sambafiles_check(cmdargs): + if (cmdargs.sambafiles): + 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 +275,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 +299,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 +321,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() |