server.py 560 Bytes
Newer Older
Fardale's avatar
Fardale committed
1 2 3 4 5 6 7 8
#!/usr/bin/python3

import http.server
import subprocess
import sys


def ssh(host, command):
Fardale's avatar
Fardale committed
9 10
    cossh = subprocess.Popen(["ssh", "%s" % host, command], shell=False, stdout=subprocess.PIPE)
    print(cossh.stdout.readlines())
Fardale's avatar
Fardale committed
11

Fardale's avatar
Fardale committed
12
PORT = 8080
Fardale's avatar
Fardale committed
13 14 15 16 17 18 19 20 21 22
server_address = ("", PORT)

server = http.server.HTTPServer
handler = http.server.SimpleHTTPRequestHandler
print("Serveur actif sur le port :", PORT)

httpd = server(server_address, handler)
while True:
    httpd.handle_request()
    ssh("01.dptinfo.ens-cachan.fr", "cd projet_genielog/the_dungeon_project/; git pull")