Tuesday, August 7, 2007

managing daemon services howto

Server services are programs in daemon mode ready to serve any process requests.

Starting and stopping daemon services from redhat-based daemon services is another nice thing that has evolved over those friendly years.

Here's several ways to disable and enable daemon services. Issue as root:

One:
A simple text-based interface for managing default startup daemon services

# ntsysv

Two:
The GUI version in much more enhanced approach

# system-config-services

Three:
Another text-based interface for managing startup services including firewall and authentication settings. This one actually calls the first one.

# setup

Forth:
The CLI version of disabling/enabling daemonized application services
# chkconfig

From using the above commands, you'll see the status of your daemon services at your current runlevel.

If you wish to disable sendmail from runlevel 5 after bootup process, simply issue

# chkconfig --levels 5 sendmail off

If you have created a new daemonized application service. Here is wow to add and delete the new service?

# chkconfig --add service-name
# chkconfig --del service-name

SAMPLE USAGE:

To check for sendmail daemon status:

# service sendmail status

To start it from CLI:

# service sendmail start

To stop the service:

# service sendmail stop

As you can see, it follows the following pattern:

First word would be the 'service' command, followed by the daemon name and the request command. This goes to any other daemonized services like so

# service postfix restart
# service httpd stop
# service iptables start
# service xinetd status
# service squid reload

Most of these daemon services can be found in /etc/init.d/ folder.

Now, how to know all status of daemon services at current runlevel in one shot?

# service --status-all

Simply use the linux grep to filter out running daemon services at current runlevel like so

# service --status-all | grep running

Alternatively, here's how to list down all services that would be started and launced during runlevel 5.

# chkconfig --list | grep '5:on'

How to confirm your current runlevel?

# runlevel

How to know the next runlevel the OS would run after a reboot?

# cat /etc/inittab | grep initdefault

Runlevels Legends:
0 - halt (Do NOT set initdefault to this)
1 - Single user mode
2 - Multiuser, without NFS (The same as 3, if you do not have networking)
3 - Full multiuser mode
4 - unused
5 - X11
6 - reboot (Do NOT set initdefault to this)

The old aging way to do to it:

# /etc/init.d/postfix status

See man pages

# man chkconfig

HTH

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy