Demonize a python script

Demonize a python script

Cancelled

Job Description

SORRY:
I became really busy with my own work. But I would like to resume this job. What I wanna do is to keep this script running so that I can make screenshot without launching firefox every time :) Thanks

------------------------------------------------------------------

Hi, I would like to demonize the script below.

The purpose is to keep the firefox and the display on. And, when I just throw URL and other options, the script produces the screenshot quickly.

I need to call this program from command line.

It needs to run on ubuntu 12.04.

In my own research, demonize should be the best way. But, if I can clear the purpose, it is also welcome :)

-----------------------------------------------------

#!/usr/bin/python

from optparse import OptionParser, OptionValueError

usage = "usage: %prog [options] keyword"
parser = OptionParser(usage)

parser.add_option(
"-f", "--file",
action="store",
type="string",
dest="log_file",
help="URL"
)
parser.add_option(
"-s", "--save",
action="store",
type="string",
dest="save_file",
help="save file name"
)
parser.add_option(
"-H", "--Height",
type="int",
metavar="N",
default=768,
help="screenshot height"
)
parser.add_option(
"-W", "--Width",
type="int",
metavar="N",
default=1024,
help="screenshot width"
)

(options, args) = parser.parse_args()

print "options.log_file =", options.log_file
print "options.save_file =", options.save_file
print "options.Height =", options.Height
print "options.Width =", options.Width

from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(options.Height, options.Width))
display.start()

browser = webdriver.Firefox()
browser.get(options.log_file)
browser.get_screenshot_as_file(options.save_file)
browser.quit()

display.stop()