diff options
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 6 | ||||
-rwxr-xr-x | abs/core/LinHES-system/idle.py | 45 |
2 files changed, 39 insertions, 12 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index d151b48..7d57587 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system -pkgver=8.1 -pkgrel=23 +pkgver=8.2 +pkgrel=1 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -119,7 +119,7 @@ md5sums=('a10cb96850951ae835c46f41f92463b2' '8b0298f70f97cc1dc2a58b9a73c64bd3' '911b0fbc8d9178dac1a193346c9decaf' '34fc1f58ad1eabf4eff4979d420760c0' - 'b08a9c9aa1215e9aa3aa7d2e654e72e5' + '0c6cab59e09c82e40f6e627c96d5a5f6' 'a94fe6d980f4b810f2e2ae5352084b39' '384956b4fd9bf40907856bab0e67b169' 'f4ce577e2ab1b6dbf9def46a8ab86e2d' diff --git a/abs/core/LinHES-system/idle.py b/abs/core/LinHES-system/idle.py index 16dc873..6b813b4 100755 --- a/abs/core/LinHES-system/idle.py +++ b/abs/core/LinHES-system/idle.py @@ -182,6 +182,25 @@ def mythtvsetup_check(cmdargs): msg(cmdargs," mythtv-setup is NOT running.") return True +def userlogins_check(cmdargs): + if (cmdargs.logins): + u=False + msg(cmdargs," Checking for users logged in...") + users=subprocess.check_output("who") + names=([x.split() for x in users.splitlines()]) + for i in names: + if (i[0] == "mythtv" and i[4] == "(:0)"): + msg(cmdargs," Ignoring %s %s" %(i[0],i[4])) + else: + msg(cmdargs," User logged in: %s %s" %(i[0],i[4])) + u=True + if u: + return False + else: + return True + else: + return True + def mythfe_check(cmdargs,cursor,mythDB): if ( cmdargs.runningfe ): msg(cmdargs," Checking for running and playing mythfrontends...") @@ -229,20 +248,22 @@ def usage(): idle.py checks these parts of the system in this order to determine if it is idle: + - (option -g) users are logged in return busy + ignores mythtv (:0) for busy - (option -l) mythshutdown is locked return busy - - (option -d) In a daily wake period or + - (option -d) in a daily wake period or about to start a daily wake period return busy checks the next 15 minutes. -t TIME changes time - schema is locked return busy - - There are in use programs return busy - - There are active jobs in the job queue return busy + - there are in use programs return busy + - there are active jobs in the job queue return busy - mythfilldatabase is running return busy - mythtv-setup is running return busy - - There are upcoming recordings return busy + - there are upcoming recordings return busy checks the next 15 minutes. -t TIME changes time - - (option -r) mythfrontends running - - mythfrontends playing back a recording or video - - mythfrontends not in menus + - (option -r) mythfrontends running return busy + - mythfrontends playing back a recording or video return busy + - mythfrontends not in menus return busy idle.py stops checking and returns false (busy) when the first busy is found. ''' @@ -252,6 +273,7 @@ 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('-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.') @@ -267,6 +289,11 @@ def main(args=[False]): idle=True msg(cmdargs,"Checking system idle...") + if (userlogins_check(cmdargs)): + idle = True + else: + idle = False + try: from MythTV import MythDB mythDB = MythDB() @@ -284,7 +311,7 @@ def main(args=[False]): msg(cmdargs,"Couldn't connect to MythTV backend.") be_conn=False - if ( db_conn ): + if ( db_conn and idle ): if (mythshutdownlock_check(cmdargs,cursor) and dailywake_check(cmdargs,cursor) and schemalock_check(cmdargs,cursor) and in_use(cmdargs,cursor) and job_check(cmdargs,cursor)): idle=True else: @@ -297,7 +324,7 @@ def main(args=[False]): idle=False if ( db_conn and idle ): - if ( mythfe_check(cmdargs,cursor,mythDB) ): + if (mythfe_check(cmdargs,cursor,mythDB)): idle=True else: idle=False |