removed functions, checkfs, halt, mountfs, reboot, sendsignals, sysklogd,

template, localnet and symperm files


git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@1441 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Gerard Beekmans 2002-01-15 21:12:16 +00:00
parent 67eb80483c
commit eac0ee1d91
12 changed files with 0 additions and 1054 deletions

View File

@ -4,21 +4,11 @@
&c7-introduction;
&c7-usage;
&c7-functions;
&c7-checkfs;
&c7-halt;
&c7-loadkeys;
&c7-mountfs;
&c7-reboot;
&c7-sendsignals;
&c7-setclock;
&c7-sysklogd;
&c7-template;
&c7-localnet;
&c7-network;
&c7-hosts;
&c7-ethnet;
&c7-symperm;
</chapter>

View File

@ -1,111 +0,0 @@
<sect1 id="ch07-checkfs">
<title>Creating the checkfs script</title>
<?dbhtml filename="checkfs.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/checkfs</filename> script by running
the following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/checkfs &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/checkfs
#
# Include the functions declared in the /etc/init.d/functions file
#
source /etc/init.d/functions
#
# Activate all the swap partitions declared in the /etc/fstab file
#
echo -n "Activating swap..."
/sbin/swapon -a
evaluate_retval
#
# If the /fastboot file exists we don't want to run the partition checks
#
if [ -f /fastboot ]
then
echo "Fast boot, no file system check"
else
#
# Mount the root partition read-only (just in case the kernel mounts it
# read-write and we don't want to run fsck on a read-write mounted
# partition).
#
/bin/mount -n -o remount,ro /
if [ $? = 0 ]
then
#
# If the /forcefsck file exists we want to force a partition check even
# if the partition was unmounted cleanly the last time
#
if [ -f /forcefsck ]
then
echo -n "/forcefsck exists, forcing "
echo "file system check"
force="-f"
else
force=""
fi
#
# Check all the file systems mentioned in /etc/fstab that have the
# fs_passno value set to 1 or 2 (the 6th field. See man fstab for more
# info)
#
echo "Checking file systems..."
/sbin/fsck $force -a -A -C -T
#
# If something went wrong during the checks of one of the partitions,
# fsck will exit with a return value greater than 1. If this is
# the case we start sulogin so you can repair the damage manually
#
if [ $? -gt 1 ]
then
$FAILURE
echo
echo -n "fsck failed. Please repair your file "
echo "systems manually by running /sbin/fsck"
echo "without the -a option"
echo
echo -n "Please note that the root file system "
echo "is currently mounted in read-only mode."
echo
echo -n "I will start sulogin now. When you "
echo "logout I will reboot your system."
echo
$NORMAL
/sbin/sulogin
/sbin/reboot -f
else
print_status success
fi
else
#
# If the remount to read-only mode didn't work abort the fsck and print
# an error
#
echo -n "Cannot check root file system because it "
echo "could not be mounted in read-only mode."
fi
fi
# End /etc/init.d/checkfs
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,506 +0,0 @@
<sect1 id="ch07-functions">
<title>Creating the functions script</title>
<?dbhtml filename="functions.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/functions</filename> script by running
the following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/functions &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/functions
#
# Set a few variables that influence the text that's printed on the
# screen. The SET_COL variable starts the text in the column number
# decided by the COL and WCOL section (as defined by the COL
# variable). NORMAL prints text in normal mode.
# SUCCESS prints text in a green colour and FAILURE prints text in a red
# colour
#
# If COLUMNS hasn't been set yet (bash sets it but not when called as
# sh), do it ourself
if [ -z "$COLUMNS" ]
then
# Get the console device if we don't have it already
# This is ok by the FHS as there is a fallback if
# /usr/bin/tty isn't available, for example at bootup.
test -x /usr/bin/tty &amp;&amp; CONSOLE=`/usr/bin/tty`
test -z "$CONSOLE" &amp;&amp; CONSOLE=/dev/console
# Get the console size (rows columns)
SIZE=$(stty size &lt; $CONSOLE)
# Strip off the rows leaving the columns
COLUMNS=${SIZE#*\ }
fi
COL=$[$COLUMNS - 10]
WCOL=$[$COLUMNS - 30]
SET_COL="echo -en \\033[${COL}G"
SET_WCOL="echo -en \\033[${WCOL}G"
NORMAL="echo -en \\033[0;39m"
SUCCESS="echo -en \\033[1;32m"
WARNING="echo -en \\033[1;33m"
FAILURE="echo -en \\033[1;31m"
#
# The evaluate_retval function evaluates the return value of the process
# that was run just before this function was called. If the return value
# was 0, indicating success, the print_status function is called with
# the 'success' parameter. Otherwise the print_status function is called
# with the failure parameter.
#
evaluate_retval()
{
if [ $? = 0 ]
then
print_status success
else
print_status failure
fi
}
#
# The print_status prints [ OK ] or [FAILED] to the screen. OK appears
# in the colour defined by the SUCCESS variable and FAILED appears in
# the colour defined by the FAILURE variable. Both are printed starting
# in the column defined by the COL variable.
#
print_status()
{
#
# If no parameters are given to the print_status function, print usage
# information.
#
if [ $# = 0 ]
then
echo "Usage: print_status {success|failure}"
return 1
fi
case "$1" in
success)
$SET_COL
echo -n "[ "
$SUCCESS
echo -n "OK"
$NORMAL
echo " ]"
;;
warning)
$SET_COL
echo -n "[ "
$WARNING
echo -n "ATTN"
$NORMAL
echo " ]"
;;
failure)
$SET_COL
echo -n "["
$FAILURE
echo -n "FAILED"
$NORMAL
echo "]"
;;
esac
}
#
# The loadproc function starts a process (often a daemon) with
# proper error checking
#
loadproc()
{
#
# If no parameters are given to the print_status function, print usage
# information.
#
if [ $# = 0 ]
then
echo "Usage: loadproc {program}"
exit 1
fi
#
# Find the basename of the first parameter (the daemon's name without
# the path
# that was provided so /usr/sbin/syslogd becomes plain 'syslogd' after
# basename ran)
#
base=$(/usr/bin/basename $1)
#
# the pidlist variable will contains the output of the pidof command.
# pidof will try to find the PID's that belong to a certain string;
# $base in this case
#
pidlist=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $base)
pid=""
for apid in $pidlist
do
if [ -d /proc/$apid ]
then
pid="$pid $apid"
fi
done
#
# If the $pid variable contains anything (from the previous for loop) it
# means the daemon is already running
#
if [ ! -n "$pid" ]
then
#
# Empty $pid variable means it's not running, so we run "$@" (all
# parameters giving to this function from the script) and then check the
# return value
#
"$@"
evaluate_retval
else
#
# The variable $pid was not empty, meaning it was already running. We'll
# print [ ATTN ] now
#
$SET_WCOL
echo -n "Already running"
print_status warning
fi
}
#
# The killproc function kills a process with proper error checking
#
killproc()
{
#
# If no parameters are given to the print_status function, print usage
# information.
#
if [ $# = 0 ]
then
echo "Usage: killproc {program} [signal]"
exit 1
fi
#
# Find the basename of the first parameter (the daemon's name without
# the path
# that was provided so /usr/sbin/syslogd becomes plain 'syslogd' after
# basename ran)
#
base=$(/usr/bin/basename $1)
#
# Check if we gave a signal to kill the process with (like -HUP, -TERM,
# -KILL, etc) to this function (the second parameter). If no second
# parameter was provided set the nolevel variable. Else set the
# killlevel variable to the value of $2 (the second parameter)
#
if [ "$2" != "" ]
then
killlevel=-$2
else
nolevel=1
fi
#
# the pidlist variable will contains the output of the pidof command.
# pidof will try to find the PID's that belong to a certain string;
# $base in this case
#
pidlist=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $base)
pid=""
for apid in $pidlist
do
if [ -d /proc/$apid ]
then
pid="$pid $apid"
fi
done
#
# If $pid contains something from the previous for loop it means one or
# more PID's were found that belongs to the processes to be killed
#
if [ -n "$pid" ]
then
#
# If no kill level was specified we'll try -TERM first and then sleep
# for 2 seconds to allow the kill to be completed
#
if [ "$nolevel" = 1 ]
then
/bin/kill -TERM $pid
#
# If after -TERM the PID still exists we'll wait 2 seconds before
# trying to kill it with -KILL. If the PID still exist after that, wait
# two more seconds. If the PIDs still exist by then it's safe to assume
# that we cannot kill these PIDs.
#
if /bin/ps h $pid &gt;/dev/null 2&gt;&amp;1
then
/usr/bin/sleep 2
if /bin/ps h $pid &gt; /dev/null 2&gt;&amp;1
then
/bin/kill -KILL $pid
if /bin/ps h $pid &gt; /dev/null 2&gt;&amp;1
then
/usr/bin/sleep 2
fi
fi
fi
/bin/ps h $pid &gt;/dev/null 2&gt;&amp;1
if [ $? = 0 ]
then
#
# If after the -KILL it still exists it can't be killed for some reason
# and we'll print [FAILED]
#
print_status failure
else
#
# It was killed, remove possible stale PID file in /var/run and
# print [ OK ]
#
/bin/rm -f /var/run/$base.pid
print_status success
fi
else
#
# A kill level was provided. Kill with the provided kill level and wait
# for 2 seconds to allow the kill to be completed
#
/bin/kill $killlevel $pid
if /bin/ps h $pid &gt; /dev/null 2&gt;&amp;1
then
/usr/bin/sleep 2
fi
/bin/ps h $pid &gt;/dev/null 2&gt;&amp;1
if [ $? = 0 ]
then
#
# If ps' return value is 0 it means it ran ok which indicates that the
# PID still exists. This means the process wasn't killed properly with
# the signal provided. Print [FAILED]
#
print_status failure
else
#
# If the return value was 1 or higher it means the PID didn't exist
# anymore which means it was killed successfully. Remove possible stale
# PID file and print [ OK ]
#
/bin/rm -f /var/run/$base.pid
print_status success
fi
fi
else
#
# The PID didn't exist so we can't attempt to kill it. Print [ ATTN ]
#
$SET_WCOL
echo -n "Not running"
print_status warning
fi
}
#
# The reloadproc functions sends a signal to a daemon telling it to
# reload it's configuration file. This is almost identical to the
# killproc function with the exception that it won't try to kill it with
# a -KILL signal (aka -9)
#
reloadproc()
{
#
# If no parameters are given to the print_status function, print usage
# information.
#
if [ $# = 0 ]
then
echo "Usage: reloadproc {program} [signal]"
exit 1
fi
#
# Find the basename of the first parameter (the daemon's name without
# the path that was provided so /usr/sbin/syslogd becomes plain 'syslogd'
# after basename ran)
#
base=$(/usr/bin/basename $1)
#
# Check if we gave a signal to send to the process (like -HUP)
# to this function (the second parameter). If no second
# parameter was provided set the nolevel variable. Else set the
# killlevel variable to the value of $2 (the second parameter)
#
if [ -n "$2" ]
then
killlevel=-$2
else
nolevel=1
fi
#
# the pidlist variable will contains the output of the pidof command.
# pidof will try to find the PID's that belong to a certain string;
# $base in this case
#
pidlist=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $base)
pid=""
for apid in $pidlist
do
if [ -d /proc/$apid ]
then
pid="$pid $apid"
fi
done
#
# If $pid contains something from the previous for loop it means one or
# more PID's were found that belongs to the processes to be reloaded
#
if [ -n "$pid" ]
then
#
# If nolevel was set we will use the default reload signal SIGHUP.
#
if [ "$nolevel" = 1 ]
then
/bin/kill -SIGHUP $pid
evaluate_retval
else
#
# Else we will use the provided signal
#
/bin/kill $killlevel $pid
evaluate_retval
fi
else
#
# If $pid is empty no PID's have been found that belong to the process.
# Print [ ATTN ]
#
$SET_WCOL
echo -n "Not running"
print_status warning
fi
}
#
# The statusproc function will try to find out if a process is running
# or not
#
statusproc()
{
#
# If no parameters are given to the print_status function, print usage
# information.
#
if [ $# = 0 ]
then
echo "Usage: status {program}"
return 1
fi
#
# $pid will contain a list of PID's that belong to a process
#
pid=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $1)
if [ -n "$pid" ]
then
#
# If $pid contains something, the process is running, print the contents
# of the $pid variable
#
echo "$1 running with Process ID $pid"
return 0
fi
#
# If $pid doesn't contain it check if a PID file exists and inform the
# user about this stale file.
#
if [ -f /var/run/$1.pid ]
then
pid=$(/usr/bin/head -1 /var/run/$1.pid)
if [ -n "$pid" ]
then
echo "$1 not running but /var/run/$1.pid exists"
return 1
fi
else
echo "$1 is not running"
fi
}
# End /etc/init.d/functions
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,22 +0,0 @@
<sect1 id="ch07-halt">
<title>Creating the halt script</title>
<?dbhtml filename="halt.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/halt</filename> script by running the
following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/halt &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/halt
#
# Call halt. See man halt for the meaning of the parameters
#
/sbin/halt -d -f -i -p
# End /etc/init.d/halt
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,52 +0,0 @@
<sect1 id="ch07-localnet">
<title>Creating the localnet script</title>
<?dbhtml filename="localnet.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/localnet</filename> script by running
the following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/localnet &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/localnet
#
# Include the functions declared in the /etc/init.d/functions file
# and include the variables from the /etc/sysconfig/network file.
#
source /etc/init.d/functions
source /etc/sysconfig/network
case "$1" in
start)
echo -n "Bringing up the loopback interface..."
/sbin/ifconfig lo 127.0.0.1
evaluate_retval
echo -n "Setting up hostname..."
/bin/hostname $HOSTNAME
evaluate_retval
;;
stop)
echo -n "Bringing down the loopback interface..."
/sbin/ifconfig lo down
evaluate_retval
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0: {start|stop|restart}"
exit 1
;;
esac
# End /etc/init.d/localnet
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,105 +0,0 @@
<sect1 id="ch07-mountfs">
<title>Creating the mountfs script</title>
<?dbhtml filename="mountfs.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/mountfs</filename> script by running
the following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/mountfs &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/mountfs
#
# Include the functions declared in the /etc/init.d/functions file
#
source /etc/init.d/functions
case "$1" in
start)
#
# Remount the root partition in read-write mode. -n tells mount
# not to
# write to the /etc/mtab file (because it can't do this. The
# root
# partition is most likely still mounted in read-only mode
#
echo -n "Remounting root file system in read-write mode..."
/bin/mount -n -o remount,rw /
evaluate_retval
#
# First empty the /etc/mtab file. Then remount root partition
# in read-write
# mode again but pass -f to mount. This way mount does
# everything
# except the mount itself. This is needed for it to write to the
# mtab
# file which contains a list of currently mounted file systems.
#
echo &gt; /etc/mtab
/bin/mount -f -o remount,rw /
#
# Remove the possible /fastboot and /forcefsck files. they are
# only
# supposed to be used during the next reboot's checkfs which just
# happened. If you want to fastboot or forcefsck again you'll
# have to
# recreate the files
#
/bin/rm -f /fastboot /forcefsck
#
# Walk through /etc/fstab and mount all file systems that don't
# have the noauto option set in the fs_mntops field (the 4th
# field.
# See man fstab for more info)
#
echo -n "Mounting other file systems..."
/bin/mount -a
evaluate_retval
;;
stop)
#
# Deactivate all the swap partitions
#
echo -n "Deactivating swap..."
/sbin/swapoff -a
evaluate_retval
#
# And unmount all the file systems, mounting the root file
# system
# read-only (all are unmounted but because root can't be
# unmounted
# at this point mount will automatically mount it read-only
# which
# is what supposed to happen. This way no data can be written
# anymore from disk)
#
echo -n "Unmounting file systems..."
/bin/umount -a -r
evaluate_retval
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
# End /etc/init.d/mountfs
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,25 +0,0 @@
<sect1 id="ch07-reboot">
<title>Creating the reboot script</title>
<?dbhtml filename="reboot.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/reboot</filename> script by running the
following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/reboot &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/reboot
#
# Call reboot. See man halt for the meaning of the parameters
#
echo "System reboot in progress..."
/sbin/reboot -d -f -i
# End /etc/init.d/reboot
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,39 +0,0 @@
<sect1 id="ch07-sendsignals">
<title>Creating the sendsignals script</title>
<?dbhtml filename="sendsignals.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/sendsignals</filename> script by running
the following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/sendsignals &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/sendsignals
#
# Include the functions declared in the /etc/init.d/functions file
#
source /etc/init.d/functions
#
# Send all the remaining processes the TERM signal
#
echo -n "Sending all processes the TERM signal..."
/sbin/killall5 -15
evaluate_retval
#
# Send all the remaining process (after sending them the TERM signal
# before) the KILL signal.
#
echo -n "Sending all processes the KILL signal..."
/sbin/killall5 -9
evaluate_retval
# End /etc/init.d/sendsignals
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,57 +0,0 @@
<sect1 id="ch07-symperm">
<title>Setting up symlinks and permissions</title>
<?dbhtml filename="symperm.html" dir="chapter07"?>
<para>These files get the proper permissions and the necessary symlinks
are created by running the following commands. If you didn't create the
loadkeys, setclock and/or ethnet scripts, make sure not to type them in
the commands below.</para>
<para>A note of caution: all the symlinks (that start with an S or K) have to
be of the form Sxxxname where xxx are three digits denoting the order in
which the script is executed (the lower the number the sooner it's
executed). If you feel a need to use less than three digits, make sure
you pad with extra zero's at the beginning. This means, don't use
S20mydaemon, but S020mydaemon. And don't use K2otherdaemon, but
K002otherdaemon.</para>
<para><screen><userinput>cd /etc/init.d &amp;&amp;</userinput>
<userinput>chmod 754 rc rcS functions checkfs halt loadkeys mountfs reboot &amp;&amp;</userinput>
<userinput>chmod 754 sendsignals setclock sysklogd template &amp;&amp;</userinput>
<userinput>chmod 754 localnet ethnet &amp;&amp;</userinput>
<userinput>cd ../rc0.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/ethnet K800ethnet &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sysklogd K900sysklogd &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sendsignals S800sendsignals &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/mountfs S900mountfs &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/halt S999halt &amp;&amp;</userinput>
<userinput>cd ../rc6.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/ethnet K800ethnet &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sysklogd K900sysklogd &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sendsignals S800sendsignals &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/mountfs S900mountfs &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/reboot S999reboot &amp;&amp;</userinput>
<userinput>cd ../rcS.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/localnet S100localnet &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/checkfs S200checkfs &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/mountfs S300mountfs &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/setclock S400setclock &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/loadkeys S500loadkeys &amp;&amp;</userinput>
<userinput>cd ../rc1.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/ethnet K800ethnet &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sysklogd K900sysklogd &amp;&amp;</userinput>
<userinput>cd ../rc2.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sysklogd S100sysklogd &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/ethnet K800ethnet &amp;&amp;</userinput>
<userinput>cd ../rc3.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sysklogd S100sysklogd &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/ethnet S200ethnet &amp;&amp;</userinput>
<userinput>cd ../rc4.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sysklogd S100sysklogd &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/ethnet S200ethnet &amp;&amp;</userinput>
<userinput>cd ../rc5.d &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/sysklogd S100sysklogd &amp;&amp;</userinput>
<userinput>ln -sf ../init.d/ethnet S200ethnet</userinput></screen></para>
</sect1>

View File

@ -1,62 +0,0 @@
<sect1 id="ch07-sysklogd">
<title>Creating the sysklogd script</title>
<?dbhtml filename="sysklogd.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/sysklogd</filename> script by running
the following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/sysklogd &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/sysklogd
#
# Include the functions declared in the /etc/init.d/functions file
#
source /etc/init.d/functions
case "$1" in
start)
echo -n "Starting system log daemon..."
loadproc /usr/sbin/syslogd -m 0
echo -n "Starting kernel log daemon..."
loadproc /usr/sbin/klogd
;;
stop)
echo -n "Stopping kernel log daemon..."
killproc klogd
echo -n "Stopping system log daemon..."
killproc syslogd
;;
reload)
echo -n "Reloading system log daemon configuration file..."
reloadproc syslogd 1
;;
restart)
$0 stop
/usr/bin/sleep 1
$0 start
;;
status)
statusproc /usr/sbin/syslogd
statusproc /usr/sbin/klogd
;;
*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
;;
esac
# End /etc/init.d/sysklogd
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -1,55 +0,0 @@
<sect1 id="ch07-template">
<title>Creating the template script</title>
<?dbhtml filename="template.html" dir="chapter07"?>
<para>Create the <filename>/etc/init.d/template</filename> script by running
the following command:</para>
<para><screen><userinput>cat &gt; /etc/init.d/template &lt;&lt; "EOF"</userinput>
#!/bin/sh
# Begin /etc/init.d/
#
# Include the functions declared in the /etc/init.d/functions file
#
source /etc/init.d/functions
case "$1" in
start)
echo -n "Starting ..."
loadproc
;;
stop)
echo -n "Stopping ..."
killproc
;;
reload)
echo -n "Reloading ..."
reloadproc
;;
restart)
$0 stop
/usr/bin/sleep 1
$0 start
;;
status)
statusproc
;;
*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
;;
esac
# End /etc/init.d/
<userinput>EOF</userinput></screen></para>
</sect1>

View File

@ -332,21 +332,11 @@
<!ENTITY chapter7 SYSTEM "chapter7/chapter7.xml">
<!ENTITY c7-introduction SYSTEM "chapter7/introduction.xml">
<!ENTITY c7-usage SYSTEM "chapter7/usage.xml">
<!ENTITY c7-functions SYSTEM "chapter7/functions.xml">
<!ENTITY c7-reboot SYSTEM "chapter7/reboot.xml">
<!ENTITY c7-halt SYSTEM "chapter7/halt.xml">
<!ENTITY c7-mountfs SYSTEM "chapter7/mountfs.xml">
<!ENTITY c7-sendsignals SYSTEM "chapter7/sendsignals.xml">
<!ENTITY c7-checkfs SYSTEM "chapter7/checkfs.xml">
<!ENTITY c7-sysklogd SYSTEM "chapter7/sysklogd.xml">
<!ENTITY c7-template SYSTEM "chapter7/template.xml">
<!ENTITY c7-loadkeys SYSTEM "chapter7/loadkeys.xml">
<!ENTITY c7-setclock SYSTEM "chapter7/setclock.xml">
<!ENTITY c7-localnet SYSTEM "chapter7/localnet.xml">
<!ENTITY c7-network SYSTEM "chapter7/network.xml">
<!ENTITY c7-hosts SYSTEM "chapter7/hosts.xml">
<!ENTITY c7-ethnet SYSTEM "chapter7/ethnet.xml">
<!ENTITY c7-symperm SYSTEM "chapter7/symperm.xml">
<!ENTITY chapter8 SYSTEM "chapter8/chapter8.xml">
<!ENTITY c8-introduction SYSTEM "chapter8/introduction.xml">