web applications - Web App to run Python Scripts - Run as a background process. -
i have python script want user run in server, out giving ssh login permission. got web app below link. how connect webpage python mod_wsgi?
here modified version that's working me
import web class echo: def get(self): return """<html><form name="script-input-form" action="/" method="post"> <p><label for="import"><font color=green><b>press button import csv</b></font)</label> import: <input type="submit" value="importcsv"></p> </form><html>""" def post(self): data = web.input() return data obj = compile('execfile("importcsv.py")', '', 'exec') result = eval(obj, globals(), locals()) web.seeother('/') urls = ( '/.*', echo, ) if __name__ == "__main__": app = web.application(urls, globals()) app.run() else: app = web.application(urls, globals()).wsgifunc()
script stored in site.py , executing command "python2.7 site.py 10.10.10.19:8080". when user access 10.10.10.19:8080 can see web page , click on button when wants code executed.
now issues
web page stops when close ssh session :(
how run in background? tried & , didn't help.
thanks , regards, rijil hari
it looks want spawn new process, since current process attached shell (alternatively, detach terminal ssh session).
to spawn new process can refer bash spawn new process, or can try this option instead keeps session alive after disconnect.
Comments
Post a Comment