je sai qu'il doivent rendre la main, comme évoque précédemment cela fait partie du comportement original du programme ... qui est écrit en perl
peut être y a t'il moyen de le modifier ...
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# (c) Pier 2004
# p.mattioli@lillinet.org
# Wed May 26 00:49:55 2004
# Wed Jun 9 00:32:56 2004
import socket
import os
import time
import shutil
import sys
import glob
CPU = int(sys.argv[1])
BLENDERPATH = sys.argv[2]
PATH, file = os.path.split(sys.argv[0])
HOST = ""
PORT = 26054
#####################################################################
# try -> except provvisorio fino a nuova GUI
#####################################################################
try :
REPOSPATH = sys.argv[3]
except:
REPOSPATH = "/tmp/"
#####################################################################
# Controllo l'esistenza della dir REPOSITORY
#####################################################################
try :
os.chdir(str(REPOSPATH))
except :
try : os.makedirs(str(REPOSPATH))
except :
print " [ ERROR : Cannot create "+str(REPOSPATH)
print " [ ERROR : Using /tmp/ as repository directory"
REPOSPATH = "/tmp"
os.chdir(str(REPOSPATH))
#####################################################################
# Mi metto in ascolto
#####################################################################
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind((HOST,PORT))
while 1:
try:
while 1:
#######################################################################
# STABILISCO LA CONNESSIONE
#######################################################################
serversocket.listen(1)
conn, addr = serversocket.accept()
OPZIONE = conn.recv(1024)
######################################################################
# RISVEGLIO DEL NODO
######################################################################
if OPZIONE == "wakeup":
os.chdir(sys.path[0])
conn.send("recvd")
conn.recv(1024)
conn.close()
LOOP=CPU
time.sleep(0.5)
while LOOP:
LOOP = LOOP -1
try:
os.spawnlp(os.P_NOWAIT, "./piovraclient.py", "./piovraclient.py", str(addr[0]), str(REPOSPATH), str(PORT-1), str(BLENDERPATH))
except:
os.system("start \"PiovraClient\" piovraclient.py " + str(addr[0]) +" \""+str(REPOSPATH)+"\" " + str(PORT-1) + " \"" +str(BLENDERPATH)+ "\" " )
os.chdir(str(REPOSPATH))
######################################################################
# PULITURA DIRECTORY
######################################################################
if OPZIONE == "purge":
conn.send("tipo")
FILETYPE = conn.recv(1024)
try :
filename = glob.glob("*."+str(FILETYPE))
LOOP = len(filename)
conn.send(" [ "+str(LOOP)+" file deleted")
conn.recv(1024)
conn.close()
while LOOP:
os.remove(filename[LOOP-1])
LOOP = LOOP-1
except :
conn.send(" ERROR IN PURGE ")
conn.recv(1024)
conn.close()
######################################################################
# RICONSEGNA RENDER ULTIMATI
######################################################################
if OPZIONE == "recv":
conn.send("tipo")
FILETYPE = conn.recv(1024)
filename = glob.glob("*."+str(FILETYPE))
LOOP = len(filename)
conn.send(str(LOOP))
conn.recv(1024)
while LOOP:
LOOP = LOOP -1
conn.send(filename[LOOP])
conn.recv(1024)
f = open(filename[LOOP], "rb")
blk = f.read(1024)
while blk:
conn.send(blk)
conn.recv(1024)
blk = f.read(1024)
f.close()
conn.send("NOMORE")
conn.recv(1024)
conn.send('chiudo')
conn.recv(1024)
conn.close()
try:
LOOP = len(filename)
while LOOP:
os.remove(filename[LOOP-1])
LOOP = LOOP-1
except :
conn.send(" ERROR IN PURGE ")
conn.recv(1024)
conn.close()
######################################################################
# SPENGO LA MACCHINA
######################################################################
if OPZIONE == "halt":
conn.send("recvd")
conn.recv(1024)
conn.close()
os.system("halt")
os.system("shutdown -s -t 00")
###############################################################################
# ESEGUO UN COMANDO DI SISTEMA
###############################################################################
if OPZIONE == "exec":
conn.send("ok")
COMMAND = conn.recv(1024)
os.system(str(COMMAND)+" > out.out")
f = open ("out.out","r")
OUTPUT = f.readline()
while OUTPUT:
conn.send(OUTPUT)
conn.recv(1024)
OUTPUT = f.readline()
conn.send("FINE")
conn.recv(1024)
conn.close()
f.close()
os.remove("out.out")
except: print (" Piovra slave error: please e-mail to p.mattioli@lillinet.org")
proxy wrote:freaks wrote:oui c bon maintenant juste le fait que le programme ne me rende pas la main (il est ecrit comme ça semble t-il ...)
j'espère que cela ne sera pa génant au démarrage ....
Ils doivent rendre la main !! Pourquoi ne pas utiliser la fonction daemon : inspire toi d'un existant