diff options
Diffstat (limited to 'ayatanasettings/psutil.py')
-rw-r--r-- | ayatanasettings/psutil.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/ayatanasettings/psutil.py b/ayatanasettings/psutil.py deleted file mode 100644 index acdbe67..0000000 --- a/ayatanasettings/psutil.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import psutil -import os -from .appdata import APPNAME - -def isRunning(): - - for pProc in psutil.process_iter(): - - sName = pProc.name - - if not isinstance(sName, str): - - sName = pProc.name() - - if sName == 'python3' or sName == 'python': - - lCmdLine = pProc.cmdline - - if not isinstance(lCmdLine, list): - - lCmdLine = pProc.cmdline() - - for sCmd in lCmdLine: - - if sCmd.endswith(APPNAME) and pProc.pid != os.getpid(): - - return True - - elif sName.endswith(APPNAME) and pProc.pid != os.getpid(): - - return True - - return False - -def isSystemd(): - - for pProc in psutil.process_iter(): - - sName = pProc.name - - if not isinstance(sName, str): - - sName = pProc.name() - - if sName == 'systemd': - - lCmdLine = pProc.cmdline - - if not isinstance(lCmdLine, list): - - lCmdLine = pProc.cmdline() - - for sCmd in lCmdLine: - - if sCmd == '--user': - - return True - - return False |