#NEWLINE# @ task ( ) #NEWLINE# def run_server( path , server ) : #NEWLINE# #INDENT# log_path = os . path . join ( MEDIA_ROOT , 'logs' , server . owner . username , server . mod . title ) #NEWLINE# if ( not os . path . exists ( log_path ) ) : #NEWLINE# #INDENT# os . makedirs ( log_path ) #NEWLINE# #UNINDENT# with open ( os . path . join ( log_path , '{0}_{1}_{2}.txt' . format ( server . id , timezone . now ( ) . strftime ( '%y%m%d%H%M%S' ) , User . objects . make_random_password ( ) ) ) , 'w' ) as f : #NEWLINE# #INDENT# p = Popen ( ( os . path . join ( path , SERVER_EXEC ) , '-f' , os . path . join ( path , 'servers' , server . owner . username , '{0}' . format ( server . id ) , server . random_key , 'generated.cfg' ) ) , cwd = path , stdout = f , stderr = f ) #NEWLINE# server . pid = p . pid #NEWLINE# server . online = True #NEWLINE# server . locked = False #NEWLINE# server . save ( )