« HOWTO:Change the UID and GID on filesHOWTO: Setup Apache server on Fedora »

HOWTO: Work with Services, auto start, stop, start

03/12/10

Permalink 08:31:08 am, by richard Email , 346 words   English (GB)
Categories: Fedora, Installing and Configuration, Systems Administration

HOWTO: Work with Services, auto start, stop, start

When you install a new service on Fedora, such as a web server, time synchronisation, sql server it will not be configured to automatically start on a reboot. To sort this out is only a few steps away.

To configure the service and stop and start it we use two commands, chkconfig and service. Have a look at their man pages.

To see if a service is configured to automatically start-up at boot time or even configured at all

sudo chkconfig --list mysqld

If you see a message similar to this then the service is not configured at all. Like the warning says you will need to use the--add option. (You can use the --del option to remove unwanted services)

service mysqld supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add mysqld')

Once the service has been added you will see output from chkconfig similar to this:

mysqld          0:off 1:off 2:off 3:off    4:off    5:off  6:off

See that for all the run levels the service is marked as off. This means the service will not at as the system is booted. To turn on the defaults that the author of the system has set, or to turn off the automatic startup use the commands below:

sudo chkconfig mysqld   on
sudo chkconfig mysqld   off

the output from chkconfig --list should now look like

mysqld          0:off 1:off 2:on 3:on 4:on 5:on 6:off

You can even set or unset individual levels to override the defaults by using the --level option

We have now configured the service to stop and start automaticially when you reboot. As this is Linux and not Windows we do keep rebooting our server just because we changed one server. We can stop and start individual services using the service command. The service command has a number of sub commands. The common ones are stop, start, restart and status· Most services will display you their usage text if you enter a duff sub command "qqq" usually works &#59;)

sudo service mysqld start
sudo service mysqld stop
sudo service mysqld restart
sudo service mysqld status

No feedback yet

Here are a collection of Mini-HOWTOs some of which are too short even for that grand title. I keep them around as it is easier to remember where to look these up that to remember the content of the mini-HOWTO

Search

Contents

powered by b2evolution