Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've written an upstart script I want to run when my server starts up, only it does not. It will run when I call sudo start wiki, where wiki is the name of my service, however it stops running when I log out.

This is the script:

description "run the noplwiki web service"

start on runlevel [2345]


    exec >> ${logfile} 2>&1

    . /home/matt/.virtualenvs/noplwiki/bin/activate

    cd ${source}
    exec python
end script

this is the log file for when I start it when I'm logged in, request something from the service and then log out:

[20/Oct/2012:18:27:28] ENGINE Listening for SIGHUP.
[20/Oct/2012:18:27:28] ENGINE Listening for SIGTERM.
[20/Oct/2012:18:27:28] ENGINE Listening for SIGUSR1.
[20/Oct/2012:18:27:28] ENGINE Bus STARTING
[20/Oct/2012:18:27:28] ENGINE Started monitor thread '_TimeoutMonitor'.
[20/Oct/2012:18:27:28] ENGINE Started monitor thread 'Autoreloader'.
[20/Oct/2012:18:27:29] ENGINE Serving on
[20/Oct/2012:18:27:29] ENGINE Bus STARTED - - [20/Oct/2012:18:27:41] "GET / HTTP/1.1" 200 699 "" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0" - - [20/Oct/2012:18:27:41] "GET /js/index.js HTTP/1.1" 304 - "" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0"
[20/Oct/2012:18:27:51] ENGINE Restarting because /home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/pymongo/ changed.
[20/Oct/2012:18:27:51] ENGINE Stopped thread 'Autoreloader'.
[20/Oct/2012:18:27:51] ENGINE Bus STOPPING
[20/Oct/2012:18:27:51] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('', 8080)) shut down
[20/Oct/2012:18:27:51] ENGINE Stopped thread '_TimeoutMonitor'.
[20/Oct/2012:18:27:51] ENGINE Bus STOPPED
[20/Oct/2012:18:27:51] ENGINE Bus EXITING
[20/Oct/2012:18:27:51] ENGINE Bus EXITED
[20/Oct/2012:18:27:51] ENGINE Waiting for child threads to terminate...
[20/Oct/2012:18:27:51] ENGINE Re-spawning
Traceback (most recent call last):
  File "", line 46, in <module>
    cherrypy.quickstart(Server(), '/', conf)
  File "/home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/cherrypy/", line 161, in quickstart
  File "/home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/cherrypy/process/", line 332, in block
  File "/home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/cherrypy/process/", line 376, in _do_execv
OSError: [Errno 2] No such file or directory: '/home/matt/python/noplwiki'

Why does it shut down when I log out? As far as I can tell the file has not been changed.

-rw-rw-r-- 1 matt matt 7350 Oct 15 20:32 /home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/pymongo/

share|improve this question
Just guessing, but is your home directory encrypted? Looks like it gets unmounted as none of the files are found anymore. – Tuminoid Oct 24 '12 at 4:20
It's not encrypted as far as I know. I've tried moving the code to /opt but it's not helped. – Matt Ellen Oct 24 '12 at 8:11
@Tuminoid — It seems as if my home directory is encrypted after all. – Matt Ellen Nov 25 '12 at 8:53
In that case simply having the init job and the noplwiki outside your home should do the trick. Check mount for any other mounts that might get unmounted when you log out and avoid those. – Tuminoid Nov 28 '12 at 7:03

Your Answer


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

Browse other questions tagged or ask your own question.