Title: Computer startup and shutdown
1 Computer startup and shutdown
- Unix boot
- Unix boot is controlled by /sbin/init, which is
executed by the kernel on startup./sbin/init
reads the configuration file /etc/inittab (look
at it) - Next script is /etc/init.d/boot (bash script)
which starts processes stated in/etc/init.d/boot.
d - According to default runlevel X (stated in
/etc/inittab) the processes stated
in/etc/init.d/rcX.d (look at it) - The whole boot sequence is logged in
/var/log/boot.msg - Unix shutdown
- Machines should have a controlled shutdown. Never
use the power-off button. - Use the commands halt, shutdown, poweroff or
reboot (see man pages) - All proccesses are stopped in reverse sequence as
described by /etc/init.d/rcX.d and/etc/init.d/boo
t.d - Example
shutdown -h 4 "System going down in 4 minutes,
please log out"
2Boot scripts
geirs_at_compaqgt ls -l /etc/init.d/rc3.d/ total
0 lrwxrwxrwx 1 root root 22 2004-09-28 1341
K01SuSEfirewall2_final -gt ../SuSEfirewall2_final l
rwxrwxrwx 1 root root 10 2004-09-28 1341
K02myhttpd -gt ../myhttpd lrwxrwxrwx 1 root root
8 2004-09-27 1359 K02myntp -gt ../myntp lrwxrwxrwx
1 root root 9 2004-09-28 1341 K02mysqld -gt
../mysqld lrwxrwxrwx 1 root root 8 2004-09-28
0819 K02myssh -gt ../myssh lrwxrwxrwx 1 root
root 10 2004-10-27 1114 K02myxinet -gt
../myxinet lrwxrwxrwx 1 root root 14 2004-09-23
1545 K07splash_late -gt ../splash_late lrwxrwxrwx
1 root root 7 2004-09-23 1546 K08cron -gt
../cron lrwxrwxrwx 1 root root 9 2004-09-23
1543 K08hwscan -gt ../hwscan lrwxrwxrwx 1 root
root 7 2004-09-23 1546 S14cron -gt
../cron lrwxrwxrwx 1 root root 9 2004-09-23
1543 S14hwscan -gt ../hwscan lrwxrwxrwx 1 root
root 14 2004-09-23 1545 S15splash_late -gt
../splash_late lrwxrwxrwx 1 root root 10
2004-09-28 1341 S20myhttpd -gt ../myhttpd lrwxrwxr
wx 1 root root 8 2004-09-27 1359 S20myntp -gt
../myntp lrwxrwxrwx 1 root root 9 2004-09-28
1341 S20mysqld -gt ../mysqld lrwxrwxrwx 1 root
root 8 2004-09-28 0819 S20myssh -gt
../myssh lrwxrwxrwx 1 root root 10 2004-10-27
1114 S20myxinet -gt ../myxinet lrwxrwxrwx 1 root
root 22 2004-09-28 1341 S21SuSEfirewall2_final
-gt ../SuSEfirewall2_final geirs_at_compaqgt
3Boot scripts
- /etc/init.d/rcX.d
- Symbolic links to /etc/init.d
- A link of type Sltnumbergtltscriptnamegt will cause
the script ltscriptnamegt to be executed when the
machine goes into runlevel X - S20myntp -gt ../myntp will execute
/etc/init.d/myntp start - A link of type Kltnumbergtltscriptnamegt will cause
the script ltscriptnamegt to be executed when the
machine leaves runlevel X - K02myntp -gt ../myntp will execute
/etc/init.d/myntp stop - The scripts are executed in alphabetical order
- The scripts can be executed manually on a later
stage
4Boot scripts
- /etc/init.d/myntp (example)
!/bin/bash Correct time and start ntp
daemon case "1" in start) echo "Starting
the Network Time Protocol" /usr/local/bin/ntpd
ate 128.39.74.16 startproc /usr/local/bin/ntpd
stop) echo "Stopping the Network
Time Protocol" killproc -TERM
/usr/local/bin/ntpd status)
checkproc /usr/local/bin/ntpd restart)
0 stop 0 start ) echo
"Usage 0 startstoprestartstatus" exit
1 esac
5Installation of software
- Installation from sourcecode
- Download and unpack source code (normally a gz or
bz2 file) - If the tar-file is in directory /usr/local/src
- tar zxvf pakkenavn.tar.gz
- unpacks and puts all files in the path
/usr/local/src/pakkenavn - Read the documentation in README and/or INSTALL
- As a rule the following is done
- ./configure
- make
- su
- make install