0

I know the new Ubuntu is more in favor of systemd than the upstart, but when I immigrate my website (python+nginx+uwsgi) from the Ubuntu 14.04, the upstart script is failed to launch during the system boot phase.

The upstart script is the same as the uwsgi docs:

# simple uWSGI script

description "uwsgi tiny instance"
start on runlevel [2345]
stop on runlevel [06]

respawn

exec uwsgi --master --processes 4 --die-on-term --socket :3031 --wsgi-file /var/www/myapp.wsgi

I am sure the nginx server is correctly configured, and the command (as follow) in the upstart script can serve the website normally in the shell (I can open the web pages from the browser).

uwsgi --master --processes 4 --die-on-term --socket :3031 --wsgi-file /var/www/myapp.wsgi

My question is how to make the upstart script work properly in Ubuntu 16.04.

1
  • Please modify your text, so that there will be question.
    – sudodus
    Jan 5, 2017 at 8:24

1 Answer 1

1

I would create a systemd service to /etc/systemd/system/uwsgi.service. And disable the upstart script.

Maybe you will need to tweak the service script it a little bit, like the full path, user and After :

[Unit]
Description=uwsgi
After=network.target

[Service]
PIDFile=/run/uwsgi.pid
ExecStart=/usr/bin/uwsgi --master --processes 4 --die-on-term --socket :3031 --wsgi-file /var/www/myapp.wsgi
User=www-data
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
3
  • I think the upstart is still supported in 16.04, since the services in /etc/init can be loaded at the start-up, but I don't know what I missed.
    – foool
    Jan 5, 2017 at 8:34
  • It should, but the service is a wrapper for systemd.
    – Carl
    Jan 5, 2017 at 11:32
  • You missed that since 15.04 Upstart is not used at the system-wide level by default. Example: askubuntu.com/a/613785/43344 Upstart was still used at the per-user level. See askubuntu.com/a/613814/43344 . But even that was no longer the case as of Ubuntu 16, which you have also missed. See askubuntu.com/a/844045/43344 , askubuntu.com/a/844502/43344 , and others.
    – JdeBP
    Mar 6, 2018 at 7:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .