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.

foool
  • 101

1 Answers1

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
Carl
  • 744