Configuring Services on Slackware
Willy Sudiarto Raharjo
10 October 2005
2 comments

Introduction

Every distro (GNU/Linux Distributions) has it's own style and package management system, which lead to a variety of system configurations. Most of them can be used in several distro, but some can't and they are distro dependent. One of the example is Slackware. Some of the configuration files are different with other distro, like Mandriva, SuSE, or Fedora Core. You should read the documentation on the distro itself or read Slackbook, the complete reference to Slackware newbies. It has several formats that can be downloaded from the official website.

We have seen in my other writings that Slackware uses a different package management system (pkgtool) and also different format (.tgz). One thing that i haven't write about is the service configuration. Most of them can be configured via chkconfig commands, but not every distro provide this kind of command. Even worse, some distro has it's own ways or application to configure the services (most of them are daemons for specific application, like httpd for Apache, sshd for SSH, mysqld for MySQL, etc). RedHat or Fedora Core with ntsysv or setup, Mandriva is integrating it in their Mandriva Control Center, and same with SuSE and YaST. For Slackware itself (you guessed it....), it has one also.

Meet Pkgtool

Most of Slackware's configuration files can be set via pkgtool, so this is the preferred ways to modify your services configuration, even though you can't edit them directly. You can only edit which services that supposed to be executed at startup process. For most people, pkgtool is enough, since they don't need to know what happened in the background. All they know is some services are automatically executed and that's what they got. To access the service configuration window, launch a terminal and switch to root user using su commands and then type:

pkgtool

It will open a small window with several menus like Current, Other, Floppy, Remove, View, Setup, and Exit. There is some short description on the right side of the commands and it is self explanatory, so i don't have to put them in here. The important menu to configure the services are the Setup commands, which will open up more sub menus. Scroll down until you find the sevices menu. Press Spacebar and ENTER. You will get a new window that contains a full list of services. The item with a "X" marker is services that should be executed at startup. Press Spacebar to select/deselect the services that you want to configure and when you are done, press ENTER to switch to the main window again. Next, reboot the machine to see the changes and watch for your boot process startup (and also the boot.log file).

Old Stylist

When you want more control on what happened at startup, then you should look at the /etc/rc.d directory, where it contains a lot of configuration files that was executed at startup process. The first file is rc.M, which should be executed by init when the system is being initialized for one of the "multi user" run levels (i.e. levels 1 through 6). You will see entries like this:

# Start the sendmail daemon:
if [ -x /etc/rc.d/rc.sendmail ]; then
  . /etc/rc.d/rc.sendmail start
fi

It's actually a bash script that checks whether the /etc/rc.d/rc.sendmail was allowed to be executed or not (-x is to check for an executed file/directory). If it has the execute permission, then it would execute the file which should start the sendmail daemon with a start parameter. Otherwise, it will skip the file and the service will not be executed. Here is the rc.sendmail file look like:

#!/bin/sh
# Start/stop/restart sendmail.

# Start sendmail:
sendmail_start() {
  if [ -x /usr/sbin/sendmail ]; then
    echo "Starting sendmail MTA daemon:  /usr/sbin/sendmail -L sm-mta -bd -q25m"
    /usr/sbin/sendmail -L sm-mta -bd -q25m
    echo "Starting sendmail MSP queue runner:  /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m"
    /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m
  fi
}

# Stop sendmail:
sendmail_stop() {
  killall sendmail
}

# Restart sendmail:
sendmail_restart() {
  sendmail_stop
  sleep 1
  sendmail_start
}

case "$1" in
'start')
  sendmail_start
  ;;
'stop')
  sendmail_stop
  ;;
'restart')
  sendmail_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac

By reading the rc.M script file, you know that it will check an execute permission on each services. One way to disable a service on startup is to remove the execute permission or edit the rc.M files (give a comments on the entries that should't be activated at startup). To perform the first one, switch to root user and type:

chmod -x /etc/rc.d/rc.sendmail

In the next bootup process, the sendmail daemon will not be started automatically.

The second solution are not recommended, but if you know the risk, you can do it yourself, but always prepare for a backup, in case you messed up with the file. You can add a "#" character in the beginning of each line so it will be commented out like this:

# Start the sendmail daemon:
#if [ -x /etc/rc.d/rc.sendmail ]; then
#  . /etc/rc.d/rc.sendmail start
#fi

The Bash interpreter will ignore any line with a "#" in front of the line, so the services will not be executed at next boot.

Last Update : 5 June 2006 :: 15:10:51

Comments

1 Ahh... yess.. My mistake. It should be 10 September, but it's ok.

Thanks for the information :)

Posted by Willy Sudiarto Raharjo on 4 Oct 2005 @ 10:57:38

2 Mas, sekarang masih September kok tanggal-nya 10 Oktober 2005. Berarti belum dirilis :)
Tapi makasih udah bisa nambah ilmu saya.

Posted by Redy on 28 Sep 2005 @ 08:12:54

Post Your Comments

Your Name: *Comment:
Kode Rahasia

*Write code above:
Note: * denotes required field