old-www/HOWTO/Small-Memory/daemons.html

388 lines
6.4 KiB
HTML

<HTML
><HEAD
><TITLE
>Daemons</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.57"><LINK
REL="HOME"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Virtual Consoles"
HREF="vconsoles.html"><LINK
REL="NEXT"
TITLE="Conclusions"
HREF="conclusion.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
></TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="vconsoles.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="conclusion.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="DAEMONS"
>4. Daemons</A
></H1
><P
>Many Linux distributions run daemons most of us will never use.
Most of these daemons are loaded by scripts. Where these scripts are and what
they are called depends on your Linux distribution. Slackware set-up scripts
are buried in <TT
CLASS="FILENAME"
>/etc/rc.d/rc.*</TT
>. </P
><P
>Before you proceed, a knowledge of Unix shell script programming
would be a definite asset. However, if you have no experience writing Unix
shell scripts, what follows is probably the quickest introduction to shell
script programming ever written.</P
><P
>Take the following shell script:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>#!/bin/sh echo "hello world"
#echo "good bye cruel world"</PRE
></TD
></TR
></TABLE
><P
>The previous code will echo the string "hello world". Shell scripts
must contain the the line
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>"#!/bin/sh"</PRE
></TD
></TR
></TABLE
> at the very top line.
After that every line is executed as if you had typed it at the keyboard (think
of shell scripts as nothing more then glorified keyboard macros).</P
><P
>Lines which begin with a '#' are said to be commented out because
they do not get executed by the shell. Most start-up scripts when they load
daemons look like: </P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>if somecondition
do something
fi</PRE
></TD
></TR
></TABLE
><P
>What you want to do is comment out every line starting with the <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>if</PRE
></TD
></TR
></TABLE
>
statement and ending with the <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>fi</PRE
></TD
></TR
></TABLE
> statement. </P
><P
>If you want to find where a daemon is loaded,
search the start-up scripts for the name of the daemon. If I wanted to find
where <SPAN
CLASS="APPLICATION"
>inetd</SPAN
> is loaded in Slackware I would do the following:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SCREEN"
>$ cd /edt/rc/d $grep -n inetd rd.*</PRE
></TD
></TR
></TABLE
> </P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN60"
>4.1. <SPAN
CLASS="APPLICATION"
>inetd</SPAN
></A
></H2
><P
><SPAN
CLASS="APPLICATION"
>inetd</SPAN
> allows people to do things like <B
CLASS="COMMAND"
>telnet</B
>, <B
CLASS="COMMAND"
>ftp</B
>, and send <B
CLASS="COMMAND"
>talk</B
>
requests to your machine. If you never use your system as a server or need to
access any of its services remotely you can remove <SPAN
CLASS="APPLICATION"
>inetd</SPAN
>. </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN69"
>4.2. <SPAN
CLASS="APPLICATION"
>lpd</SPAN
></A
></H2
><P
><SPAN
CLASS="APPLICATION"
>lpd</SPAN
> is used to print files on your printer using the
<B
CLASS="COMMAND"
>lpr</B
> command. If you never print on your Linux
box you can remove <SPAN
CLASS="APPLICATION"
>lpd</SPAN
>. If, however, you own a HP Deskjet &#8482; printer and
would like to print, I highly recommend the package I put together called
dj-printcap which is available at:</P
><P
>
<A
HREF="ftp://ftp.redhat.com/pub/redhat/redhat-4.2/i386/RedHat/RPMS/dhcpcd-0.6-2.i386.rpm"
TARGET="_top"
>ftp://sunsite.unc.edu/pub/Linux/system/Printing/dj-printcap.tar.gz</A
>
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN78"
>4.3. <SPAN
CLASS="APPLICATION"
>nfsd</SPAN
> and <SPAN
CLASS="APPLICATION"
>mountd</SPAN
></A
></H2
><P
>These two daemons are used to run an NFS server. If you never use
your Linux system as an NFS server you can safely remove these two daemons.
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN83"
>4.4. <SPAN
CLASS="APPLICATION"
>portmap</SPAN
></A
></H2
><P
>The <SPAN
CLASS="APPLICATION"
>portmap</SPAN
> daemon is used to handle RPC services. If you do not
run an NFS server or any other RPC programs you can remove <SPAN
CLASS="APPLICATION"
>portmap</SPAN
>. </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN89"
>4.5. <SPAN
CLASS="APPLICATION"
>sendmail</SPAN
></A
></H2
><P
><SPAN
CLASS="APPLICATION"
>sendmail</SPAN
> is another daemon which requires a fair bit of memory.
If you never use your Linux box as a relay for sending e-mail or you never
receive mail on your Linux box, you can probably remove <SPAN
CLASS="APPLICATION"
>sendmail</SPAN
>. If you do send
e-mail from your Linux box most e-mail clients can be set-up to send e-mail
from another mail server.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN95"
>4.6. others</A
></H2
><P
>There may be other daemons your system starts up which you do
not need. Remove what you feel you have to. Two daemons which you must run are
<SPAN
CLASS="APPLICATION"
>syslogd</SPAN
> and <SPAN
CLASS="APPLICATION"
>klogd</SPAN
>. </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="vconsoles.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="conclusion.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Virtual Consoles</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Conclusions</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>