def start_timeout(self, ip, minutes, username): deploy.sendfile(WARNING_PY, "/tmp/warning.py", ips=[ip]) warning_command = REMOTE_START_WARN.format( duration=(minutes - 5 if minutes > 5 else 1), username=username) kill_command = REMOTE_START_KILL.format(duration=minutes) deploy.deploy([warning_command], ips=[ip]) deploy.deploy([kill_command], ips=[ip])
def start_lightdm(self, ip, session): f = open("/tmp/lightdm.conf", "w") f.write(LIGHTDM_CONF.format(username=session['username'])) f.close() deploy.sendfile("/tmp/lightdm.conf", "/etc/lightdm/autologin.conf", ips=[ip]) deploy.deploy(REMOTE_START_SESSION, ips=[ip])
def start_timeout(self, ip, minutes, username): deploy.sendfile(WARNING_PY, "/tmp/warning.py", ips=[ip]) warning_command = REMOTE_START_WARN.format(duration=(minutes-5 if minutes > 5 else 1), username=username) kill_command = REMOTE_START_KILL.format(duration=minutes) deploy.deploy([warning_command], ips=[ip]) deploy.deploy([kill_command], ips=[ip])
def kill_timeout(self, ip): deploy.sendfile("/tmp/lightdm.conf", "/etc/lightdm/autologin.conf", ips=[ip]) deploy.deploy([REMOTE_STOP_KILL, REMOTE_STOP_WARN], ips=[ip])
#!/usr/bin/python import datetime import os import subprocess, shlex import re import sys import time from deploy import deploy, sendfile if __name__ == '__main__': print "MAKE SURE ALL CLIENT COMPUTERS ARE TURNED ON!" print "In 5s this script will start sending a printer configuration file to alle clients." time.sleep(5) sendfile("printers.conf", "/etc/cups/printers.conf") sendfile("printer-1.ppd", "/etc/cups/ppd/printer-1.ppd") deploy(["/etc/init.d/cups restart"])
#!/usr/bin/python import datetime import os import subprocess, shlex import re import sys import time from deploy import deploy, sendfile if __name__ == '__main__': print "MAKE SURE ALL CLIENT COMPUTERS ARE TURNED ON!" print "In 2s this script will send new register_login and register_logout files" time.sleep(2) sendfile("register_login.sh", "/etc/lightdm/register_login.sh") sendfile("register_logout.sh", "/etc/lightdm/register_logout.sh")
#!/usr/bin/python import datetime import os import subprocess, shlex import re import sys import time from deploy import deploy, sendfile if __name__ == '__main__': print "MAKE SURE ALL CLIENT COMPUTERS ARE TURNED ON!" print "In 20s this script will send a fix for broken intel graphics support" time.sleep(20) sendfile("i915.conf", "/etc/modprobe.d/i915.conf")
#!/usr/bin/python import datetime import os import subprocess, shlex import re import sys import time from deploy import deploy, sendfile # REMEMBER THAT SCRIPTS SHOULD NOT OUTPUT SOMETHING BACK TO SSH # - it breaks sockets on a lot of output!! COMMANDS = [ "echo running postinstall... && sh /root/rerun-postinstall.sh > /var/log/postinstall.log 2>&1" ] if __name__ == '__main__': ssh_exec = subprocess.Popen(shlex.split("rm -f /root/.ssh/known_hosts"), stdout=subprocess.PIPE) print "MAKE SURE ALL CLIENT COMPUTERS ARE TURNED ON!" print "In 10s this script will start to ask all clients to download and rerun the postinstallation." time.sleep(10) sendfile("rerun-postinstall.sh", "/root/rerun-postinstall.sh") deploy(COMMANDS)
#!/usr/bin/python import datetime import os import subprocess, shlex import re import sys import time from deploy import deploy, sendfile if __name__ == '__main__': print "MAKE SURE ALL CLIENT COMPUTERS ARE TURNED ON!" print "In 2s this script will send new .gnomerc files" time.sleep(2) # sendfile(".gnomerc", "/home/teacher/.gnomerc") # sendfile(".gnomerc", "/home/student/.gnomerc") sendfile(".gnomerc", "/etc/skel/.gnomerc")
#!/usr/bin/python import datetime import os import subprocess, shlex import re import sys import time from deploy import deploy, sendfile # REMEMBER THAT SCRIPTS SHOULD NOT OUTPUT SOMETHING BACK TO SSH # - it breaks sockets on a lot of output!! COMMANDS = ["echo running postinstall... && sh /root/rerun-postinstall.sh > /var/log/postinstall.log 2>&1"] if __name__ == '__main__': ssh_exec = subprocess.Popen(shlex.split("rm -f /root/.ssh/known_hosts"), stdout=subprocess.PIPE) print "MAKE SURE ALL CLIENT COMPUTERS ARE TURNED ON!" print "In 10s this script will start to ask all clients to download and rerun the postinstallation." time.sleep(10) sendfile("rerun-postinstall.sh", "/root/rerun-postinstall.sh") deploy(COMMANDS)