mirror of
https://github.com/dkmstr/openuds.git
synced 2025-03-13 08:58:35 +03:00
Merge remote-tracking branch 'origin/v3.6'
This commit is contained in:
commit
57013ed1e1
@ -11,7 +11,7 @@ Release: %{release}
|
||||
Summary: Actor for Universal Desktop Services (UDS) Broker
|
||||
License: BSD3
|
||||
Group: Admin
|
||||
Requires: python3-six python3-requests python3-qt5 libXScrnSaver
|
||||
Requires: python3-six python3-requests python3-qt5 libXScrnSaver xset
|
||||
Vendor: Virtual Cable S.L.U.
|
||||
URL: http://www.udsenterprise.com
|
||||
Provides: udsactor
|
||||
|
@ -41,6 +41,8 @@ import typing
|
||||
|
||||
from .. import types
|
||||
|
||||
|
||||
from udsactor.log import logger
|
||||
from .renamer import rename
|
||||
from . import xss
|
||||
|
||||
@ -165,14 +167,19 @@ def reboot(flags: int = 0):
|
||||
'''
|
||||
Simple reboot using os command
|
||||
'''
|
||||
subprocess.call(['/sbin/shutdown', 'now', '-r']) # nosec: Fine, all under control
|
||||
|
||||
try:
|
||||
subprocess.call(['/sbin/shutdown', 'now', '-r']) # nosec: fixed params
|
||||
except Exception as e:
|
||||
logger.error('Error rebooting: %s', e)
|
||||
|
||||
def loggoff() -> None:
|
||||
'''
|
||||
Right now restarts the machine...
|
||||
'''
|
||||
subprocess.call(['/usr/bin/pkill', '-u', os.environ['USER']]) # nosec: Fine, all under control
|
||||
try:
|
||||
subprocess.call(['/usr/bin/pkill', '-u', os.environ['USER']]) # nosec: Fixed params
|
||||
except Exception as e:
|
||||
logger.error('Error killing user processes: %s', e)
|
||||
# subprocess.call(['/sbin/shutdown', 'now', '-r'])
|
||||
# subprocess.call(['/usr/bin/systemctl', 'reboot', '-i'])
|
||||
|
||||
|
@ -33,6 +33,10 @@ import ctypes
|
||||
import ctypes.util
|
||||
import subprocess # nosec
|
||||
|
||||
|
||||
from udsactor.log import logger
|
||||
|
||||
|
||||
xlib = None
|
||||
xss = None
|
||||
display = None
|
||||
@ -116,11 +120,12 @@ def _ensureInitialized():
|
||||
def initIdleDuration(atLeastSeconds: int) -> None:
|
||||
_ensureInitialized()
|
||||
if atLeastSeconds:
|
||||
subprocess.call( # nosec, controlled params
|
||||
['/usr/bin/xset', 's', '{}'.format(atLeastSeconds + 30)]
|
||||
)
|
||||
# And now reset it
|
||||
subprocess.call(['/usr/bin/xset', 's', 'reset']) # nosec: fixed command
|
||||
try:
|
||||
subprocess.call(['/usr/bin/xset', 's', '{}'.format(atLeastSeconds + 30)]) # nosec
|
||||
# And now reset it
|
||||
subprocess.call(['/usr/bin/xset', 's', 'reset']) # nosec
|
||||
except Exception as e:
|
||||
logger.error('Error setting screensaver time: %s', e)
|
||||
|
||||
|
||||
def getIdleDuration() -> float:
|
||||
|
Loading…
x
Reference in New Issue
Block a user