| |
Practical Exercises with run levels
Note, during this exercise, you won't be able to run the browser when changing the run levels
so you'd better to print out this page. If you like, you can setup CUPS utility
on your desktop to print on the Unisys lab printer - follow the
printing HOWTO
Remove gdm and xserver-xorg-input-wacom
from the startup
Switching between run levels.
Create /etc/inittab with the following entries
to boot into default Run Level 5;
reboot the system using /sbin/init 6 command.
When the system boots up, there will be no desktop manager. Login to the
system, become root (sudo -s), and
verify the current run level
with command
Change sequentially to Run Levels 3, 2, and 1 using command
where N is the next Run Level.
Run /sbin/runlevel command in every Run Level.
Adding and removing system services from the startup
Remove portmap, nfs-common, nfs-kernel-server, and
exim4 from the startup. Note, you can use apt-get install
to install them on your system.
Add portmap, nfs-common and nfs-kernel-server
to the startup to start in Level 3 and stop in Levels 0 1 2 6:
Add exim4 to the startup to start in Level 2 and stop in Levels 0 1 3 6:
Enter Run Level 3 and check which of the above services are running.
Enter Run Level 2 and check which of the above services are running.
Creating startup scripts.
Copy the script from the lecture, sample.sh, in /etc/init.d directory;
make it executable; try to run it:
Create symbolic links of the script to various /etc/rcN.d directories:
Init to Run Levels 1, 2, and 3 and notice if the init
runs S01sample and K99sample scripts: check the updated content
of file /var/log/sample.log
Remove the links.
Set the script to "stop" at run level 1, 3, and 5 and "start" at Run Levels 2 and 4:
Check what kind of links with sample.sh have been created in /etc/rc1.d
/etc/rc2.d, /etc/rc3.d, /etc/rc4.d and /etc/rc5.d
Remove the log file
Enter Run Levels 1, 2, 3, 4, and 5. Check the content of file
/var/log/sample.log.
|
|