Restart Services in Linux
While Linux is very stable, occasionally problems will occur that may force you to restart your services. You may want to stop and start one or more of your running services, such as the http server or Solid State Hybrid Drive (SSHD) to ensure that everything is working smoothly like you want it to. For more complete steps, read below the jump.
Contents
[hide]Steps
- Start with "ls /etc/init.d". This will show you the names of your services, if you're not quite sure of the formal name of the service you're looking for. The name may not be what you'd expect; Apache is actually httpd, for instance.
- Switch to the super user (root). Do this using the command "su -" and then responding to the password prompt. If you use sudo, then you could use the command "sudo -s" to switch to root, or you could add "sudo" to the front of the following command.
- Using the root user, issue the command "service <srvcname> restart". This should restart the service, if the init.d script is complete. If this doesn't work, try "service <srvcname> stop", followed by "service <srvcname> start", which should work for all the services.
- The service command controls the starting and stopping of services on a Linux system. The service name can be such things as httpd or mysqld. Each of these represents a daemon or application which runs on the system and provides some function to you, your users, or the system itself.
Tips
- You can use the "chkconfig" command to add and remove services in your system start-up. See the main page for chkconfig for details.
Warnings
- Don't stop services at random while trying this out. Some of the services listed in /etc/init.d are necessary to keep your system stable and running happily.
- If you want to restart your networking, be sure you're logged in on the system's console. If you are logged in over the networking interface and restart it, you'll lose your connection in the process. This may mean a trip to the console anyway, and downtime for your users.
Related Articles
- Use Linux
- Install Knoppix Linux
- Arrange a Linux Install Party
- Optimize a Realtek Based Wireless Connection in Linux Mint
- Choose an MP3 Player for Linux
- Format a Linux Hard Disk to Windows