Skip to content

Instantly share code, notes, and snippets.

@sandheepg
Last active July 28, 2017 12:45
Show Gist options
  • Select an option

  • Save sandheepg/d962e101653439aeb9b79c2c2d9a9bf1 to your computer and use it in GitHub Desktop.

Select an option

Save sandheepg/d962e101653439aeb9b79c2c2d9a9bf1 to your computer and use it in GitHub Desktop.
Manage Services in Linux

There are many ways out there to manage a Linux service depending on the distribution you are using.

This mainly boils down to if your distribution uses systemd or init. Based on that, systemctl and service are two officially adopted service managers for controlling services.

Intrestingly, service command still works even for those distributions that have migrated to systemd and systemctl.

Lets take the example of restarting nginx service to see how this can be done.

Type the below commands in the terminal to restart nginx for the changes to take effect.

sudo service nginx restart
OR
sudo /etc/init.d/nginx restart
OR
sudo systmctl restart nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment