mirror of https://git.48k.eu/ogclient
Add global variable to set up OpenGnsys path
This variable allow us to modify the opengnsys path without modify several parts of the code. This change reduces the probability to add any bug forgetting to change any line.more_events
parent
694bc492a2
commit
2997952bc9
|
@ -1,14 +1,16 @@
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
OG_PATH = '/opt/opengnsys/'
|
||||
|
||||
def poweroff():
|
||||
if os.path.exists('/scripts/oginit'):
|
||||
subprocess.call('source /opt/opengnsys/etc/preinit/loadenviron.sh; /opt/opengnsys/scripts/poweroff', shell=True)
|
||||
subprocess.call('source ' + OG_SCRIPT_PATH + 'etc/preinit/loadenviron.sh; ' + OG_SCRIPT_PATH + 'scripts/poweroff', shell=True)
|
||||
else:
|
||||
subprocess.call(['/sbin/poweroff'])
|
||||
|
||||
def reboot():
|
||||
if os.path.exists('/scripts/oginit'):
|
||||
subprocess.call('source /opt/opengnsys/etc/preinit/loadenviron.sh; /opt/opengnsys/scripts/reboot', shell=True)
|
||||
subprocess.call('source ' + OG_SCRIPT_PATH + 'etc/preinit/loadenviron.sh; ' + OG_SCRIPT_PATH + 'scripts/reboot', shell=True)
|
||||
else:
|
||||
subprocess.call(['/sbin/reboot'])
|
||||
|
|
Loading…
Reference in New Issue