5

Here is my result of service nginx status command. (Debian 8 64bit)

Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: active (running) since Fri 2015-09-18 12:20:23 CEST; 2h 29min ago
Process: 31845 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=2)
Process: 29093 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
Process: 31851 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 31848 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 31852 (nginx)
CGroup: /system.slice/nginx.service
       ├─31852 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
       ├─31853 nginx: worker process                           
       ├─31854 nginx: worker process                           
       ├─31855 nginx: worker process                           
       └─31856 nginx: worker process           

I don't really understand what Process: 31845 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=2) means and why I get status code 2. Anyway It seems that nginx is working properly.

What should I do to resolve this message?

GregL
  • 9,030
  • 2
  • 24
  • 35
pinGu
  • 140
  • 1
  • 1
  • 7
  • Whoever wrote this unit file does not fully understand systemd. There is no excuse for calling start-stop-daemon in a systemd unit. Of course using Debian is something I would not recommend anyway. – Michael Hampton Sep 18 '15 at 21:03
  • @MichaelHampton Why would someone use start-stop? Where can I learn more about a better approach? – mbigras Jul 01 '18 at 03:21
  • @mbigras You wouldn't use start-stop-daemon at all. In most cases (including this one) you don't even need to set ExecStop= in the unit file at all. – Michael Hampton Jul 01 '18 at 21:39

2 Answers2

1

According to the start-stop-daemon command at this page, the status script is attempting to stop (--stop) nginx gracefully (with QUIT signal), then retry and wait at most 5 seconds (in QUIT/5). If at that moment nginx is still alive (i.e. the timeout is reached), it will return status 2.

Trying to stop a service when asked for its status is a behavior that sounds strange to me. It would fit better in a service restart script.

This does not look like a problem. I would not try to get rid of this message

user842313
  • 831
  • 4
  • 5
0

I am also got this exactly same. Instead of restarting the running server, try to stop and start

  • Stop the nginx server first
  • Then start again

Now no red marks in nginx status.