Demonize a python script

Closed - This job posting has been filled and work has been completed.
Web, Mobile & Software Dev Scripts & Utilities Posted 2 years ago

Hourly Job

Hours to be determined
Less than 1 week

Details

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()


About the Client

(5.00) 27 reviews

Japan
Minato-Ku 08:46 PM

51 Jobs Posted
55% Hire Rate, 1 Open Job

$7,927 Total Spent
36 Hires, 2 Active

$20.08/hr Avg Hourly Rate Paid
317 Hours

Member Since Oct 15, 2012