systemctl not working on a fresh Ubuntu 18.04 build

November 10, 2019 176 views
System Tools

fresh ubuntu 18.04 build
created new user and switched to that user
installed apache2, php, mysql, essentials using sudo apt-get

Works:
sudo /etc/init.d/apache2 restart
sudo systemctl status apache2

Does not Work:
sudo systemctl restart apache2
after I hit enter nothing is executed, just another standard line(user@server:~$)

Please advise. Thanks.

1 Answer

Hello,

It is normal for the systemctl command not to provide you with any output after executing a restart command.

To check if the restart was successful, what you could do is run:

echo $?

This would provide you with the exit code of the previous command. If you get a 0 it means that it was successful, if you get 1 then something is wrong and you need to run the systemctl status command to get some more information.

Hope that this helps!
Regards,
Bobby

Have another answer? Share your knowledge.