Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to get python's SimpleHTTPServer to start on boot using /etc/init/pyweb.conf and to specify the path which the script will be executed in and server files from, however I don't seem to be able to get it to work.

Here's what I have ended up with, but it's not firing off:

# Start SimpleHTTPServer
#
description "SimpleHTTPServer"
start on startup
task
exec python -m SimpleHTTPServer 
--path=/var/pyweb/
share|improve this question
add comment

migrated from stackoverflow.com Sep 21 '11 at 13:44

This question came from our site for professional and enthusiast programmers.

2 Answers

Maybe

cd

into that folder and run

python -m SimpleHTTPServer

from there?

share|improve this answer
add comment

Add chdir /var/pyweb before your exec-line.

Described here: http://upstart.ubuntu.com/wiki/Stanzas#chdir

Edit: To be clear, SimpleHTTPServer doesn't take any --path or other options like that. You can give it a port number, that's about it.

Also, you don't want to use it as something permanent (i.e. on boot, used a lot); use a real httpd for that.

Thirdly; this is more of ServerFault question.

share|improve this answer
    
Thanks very much for suggestions adding the chdir solved it. This is to be used for a touchscreen web config, the web server will probably serve one page during initial setup and potentially never serve another page unless the config is changed which is unlikely. many thanks again. –  crankshaft Sep 21 '11 at 13:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.