summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlvaro Neira Ayuso <aneira@soleta.eu>2019-12-12 18:47:02 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commit62a8ca4cd8a12871c1b03f2da9aaccd186d456e5 (patch)
tree4f670cbca24fe6464ef0b5bbc1b237f2a0c7619a
parent6479530bf54a5c1439fea8f337018c178d91c5bf (diff)
Include the poweroff support in ogOperation
This new patch allows us to turn off the linux machine using poweroff binary or in OpenGnsys client case, use the specific script.
-rw-r--r--src/linux/ogOperations.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py
index d6795b1..ba141d9 100644
--- a/src/linux/ogOperations.py
+++ b/src/linux/ogOperations.py
@@ -1,5 +1,11 @@
+import os
+import subprocess
+
def poweroff():
- print 'APAGADO'
+ if os.path.exists('/scripts/oginit'):
+ subprocess.call('source /opt/opengnsys/etc/preinit/loadenviron.sh; /opt/opengnsys/scripts/poweroff', shell=True)
+ else:
+ subprocess.call(['/sbin/poweroff'])
def reboot():
print 'REBOOT'