Service nginx reload/restart Gives No Output Unlike 14.01. Is not it? This Article Explains Why No Output From Ubuntu 16.04 service start/stop Command. We should not be expecting such output. Earlier Ubuntu versions didn’t behave this way because Ubuntu was an upstart
system for a decade. In Ubuntu 15.04 and later version, systemd is only fully supported. So, that change from upstart to systemd
made few changes. Commands actually changed and usually kind of linked with service commands with scripts.
Not Understood! Why No Output From Ubuntu 16.04 service start/stop Command?
Ubuntu 16.04 uses systemd
. Ubuntu 14.04 or earlier used upstart
. upstart
is an event-based replacement for the /sbin/init
daemon which handled starting of tasks and services during boot, stopping them during shutdown and supervising them while the system is running. systemd
is actually used by all other major GNU/Linux distro. Debian/Ubuntu service
command is a shell script that tries to detect whether upstart or systemd is the running system service manager, and run the actual native service management commands for upstart
and systemd
. It executes two pretty much entirely different code paths for upstart
and for systemd
. upstart
‘s native service management commands are initctl start
, initctl stop
, initctl status
etc. They printed the informative messages. systemd
‘s native service management commands are systemctl start
, systemctl stop
, systemctl status
and so forth. Most of the commands print no output as they operate. Hence the silent output output is expected. Here is more on Systemd :
1 | https://wiki.ubuntu.com/SystemdForUpstartUsers |
Now Understood. Is There Some Way to Get Output From Ubuntu 16.04 service start/stop Command?
You can print messages with this kind of command :
---
1 | /etc/init.d/nginx restart |
For example :
1 2 | root@abhishekghosh:~# /etc/init.d/nginx restart [ ok ] Restarting nginx (via systemctl): nginx.service. |
Another example :
1 2 | root@abhishekghosh:~# /etc/init.d/php7.0-fpm restart [ ok ] Restarting php7.0-fpm (via systemctl): php7.0-fpm.service. |
You can use /etc/init.d/
to print output on Ubuntu or simply switch to CentOS from Ubuntu. Actually CentOS at current situation is easier like Debian, Ubuntu to any kind of user.