SYA710 Lab02
SYA710 Lab #2 (Incomplete - do not start)
Focus: Linux Startup
PART A (System V on Fedora 8):
Perform the following steps:
- Login to Fedora 8 Test as root.
- Type in this script. The name of this script should be called carpal.
- Save the script in /etc/init.d/ directory.
- Now create another script named carpald - this script will be the
daemon. Your carpald script can look something like this - but feel
free to elaborate.
#!/bin/sh #loop forever while : do # now sleep for 30 seconds sleep 30 # after wakeup send message to all users wall <<EOF Ok people! Time to take a break before you get carpal tunnel syndrome! EOF done
- Save your carpald script in directory /usr/local/sbin. Make sure the owner and permissions are set correctly.
- Now run the command
chkconfig --add carpal
- Now switch to runlevel 3 with the command
telinit 3
- Login as joker and observe what happens.
- Answer questions 1-14 in PART C and then do PART B.
#!/bin/sh # # carpal # # description: carpald is a program which wakes up every so often and # tells us that we need to take a break from the keyboard # or we'll lose all functinality of our wrists and never be # able to type again as long as we live. # chkconfig: 3 92 08 [ -f /usr/local/sbin/carpald ] || exit 0 # source function library . /etc/rc.d/init.d/functions case "$1" in start) echo -n "Starting carpald: " daemon /usr/local/sbin/carpald & echo touch /var/lock/subsys/carpald ;; stop) echo -n "Stopping carpald services: " killproc /usr/local/sbin/carpald echo rm -f /var/lock/subsys/carpald ;; status) status /usr/local/sbin/carpald ;; restart|reload) $0 stop $0 start ;; *) echo "Usage: carpal {start|stop|status|restart|reload}" exit 1 ;; esac exit 0
PART B: (Upstart on Ubuntu 8.04)
Perform the following steps:
- Login to UbuntuHH Test as root.
- Answer the remaining questions in PART C and email your answers to your teacher.
PART C: - Questions
- What is your full name and Seneca student ID?
- What is the purpose of the wall command?
- Identify the full path and names of ALL startup/shutdown links created in step 6.
- What is the purpose of the chkconfig command?
- What is the purpose of the /etc/init.d/functions script?
- What is the difference between the init and telinit commands?
- What runlevels does Fedora 8 use and what is the purpose of each?
- What is the purpose of the daemon and killproc functions?
- What common arguments do startup scripts take?
- How is a daemon different from a regular user process?
- Where (what directory other than /proc) are process numbers normally saved for currently running daemons.
- What is the purpose of the dot (.) command and where is it used in this lab?
- What is a lock file used for?
- What is the full path name of the lock file used in this lab?