Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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]

script
    logfile="/var/log/wiki.log"
    source="/home/matt/python/noplwiki/"

    exec >> ${logfile} 2>&1

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

    cd ${source}
    exec python wiki.py
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 0.0.0.0:8080
[20/Oct/2012:18:27:29] ENGINE Bus STARTED
192.168.1.64 - - [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"
192.168.1.64 - - [20/Oct/2012:18:27:41] "GET /js/index.js HTTP/1.1" 304 - "http://192.168.1.66:8080/" "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/helpers.py 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(('0.0.0.0', 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 wiki.py
Traceback (most recent call last):
  File "wiki.py", line 46, in <module>
    cherrypy.quickstart(Server(), '/', conf)
  File "/home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/cherrypy/__init__.py", line 161, in quickstart
  File "/home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/cherrypy/process/wspbus.py", line 332, in block
  File "/home/matt/.virtualenvs/noplwiki/local/lib/python2.7/site-packages/cherrypy/process/wspbus.py", 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 helpers.py 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/helpers.py

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

 
discard

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

Browse other questions tagged or ask your own question.