Controlling which system services are started at boot
During the boot process, your operating system should load all services that will be running in the background on your machine. This includes database servers, web servers, tools such as Webmin, and other system processes. Server distributions are very lean by default, so they will only start a handful of essential services. Webmin allows you to control which of these scripts is executed through the Bootup and Shutdown module.
How to do it...
Perform the following steps to check which system services are started at boot:
Navigate to System | Bootup and Shutdown.
Select a service to disable temporarily. If your system has the
avahi
daemon or thersync
service, these can probably be disabled for a minute without causing trouble. Consider the following screenshot:Mark the checkbox next to one of these services and click the Disable Now and On Boot button. You will see a screen notifying you that the service was stopped and disabled from starting at the next boot.
Go back to the Bootup and Shutdown screen, select the same service again, and click the Start Now and On Boot button to revert your previous change.
How it works...
When your OS starts, it first loads the system kernel and then starts a process called init (short for initialization), which executes various init scripts that start system services. Under Linux, these scripts are stored in one directory (/etc/init.d
) and activated by the creation of symbolic links to them in a special directory from which all scripts are executed at boot time. Webmin allows you to control which init scripts are executed by creating or removing these symbolic links or performing other activation functions specific to your system.
The init system described earlier is often referred to as SysV-style init. It's named after the historic UNIX System V that inspired all modern Unix-like operating systems, including Linux and BSD. Many distributions are gradually switching over to more modern alternatives such as Upstart and Systemd. The details of how these systems differ from SysV-init are beyond the scope of this book, but Webmin tries to provide a common interface to all of them. Screenshots in this recipe may differ slightly depending on which init system your distribution uses.
There's more...
Webmin also allows you to easily create your own init scripts and verify that a started service is actually running.
Creating a custom init script
Most server packages you install will come with their own init scripts and activate them in your init system. If you install a package that doesn't, you can use Webmin to create a simple init script for you.
Navigate to System | Bootup and Shutdown and click the Create a new bootup and shutdown action link.
Note
Depending on the init system you're using, this link may also be named Create a new action
, Create a new upstart service
, Create a new systemd service
, and so on.
You will be asked to specify the name and description of the startup item as well as two commands: one for starting the service and one for shutting it down. Once you fill these out, click Create and Webmin will automatically create a basic init script for you.
Inspecting active processes
Even if a service is successfully started during boot, it could potentially crash. To inspect which services are actually running, go to System | Running Processes. There, you will see a tree of processes sorted in the order in which another process has started them. You can also sort processes by owner or the amount of CPU or RAM they are consuming. Consider the following screenshot:
Click on a process ID for one of Webmin's processes to get more information about it, including those files or network connections the process still has open.