Changes

Jump to: navigation, search

SYA710 Lab02

3,460 bytes added, 19:28, 16 September 2008
New page: == SYA710 Lab #2 (Incomplete - do not start) == === Focus: Linux Startup === === PART A (System V on Fedora 8): === Perform the following steps: <ol> <li>Login to Fedora 8 Test as root.<...
== SYA710 Lab #2 (Incomplete - do not start) ==
=== Focus: Linux Startup ===
=== PART A (System V on Fedora 8): ===
Perform the following steps:
<ol>
<li>Login to Fedora 8 Test as root.</li>
<li>Type in this script. The name of this script should be called carpal.</li>
<pre>
#!/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
</pre>
<li>Save the script in /etc/init.d/ directory. </li>
<li>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.
<pre>
#!/bin/sh
#loop forever
while :
do
# now sleep for 30 seconds
sleep 30
# after wakeup send message to all users
wall &lt;&lt;EOF
Ok people! Time to take a break before
you get carpal tunnel syndrome!
EOF
done
</pre>
</li>
<li>Save your carpald script in directory /usr/local/sbin. Make sure the owner and permissions are set correctly. </li>
<li>Now run the command
<pre>
chkconfig --add carpal
</pre>
</li>
<li>Now switch to runlevel 3 with the command
<pre>
telinit 3
</pre>
</li>
<li>Login as joker and observe what happens.
</li>
<li>Answer questions 1-14 in PART C and then do PART B.
</ol>
=== PART B: (Upstart on Ubuntu 8.04) ===
Perform the following steps:
<ol>
<li>Login to UbuntuHH Test as root.</li>
<li>Answer the remaining questions in PART C and email your answers to your teacher. </li>
</ol>
=== PART C: - Questions ===
<ol>
<li>What is your full name and Seneca student ID? </li>
<li>What is the purpose of the wall command? </li>
<li>Identify the full path and names of ALL startup/shutdown links
created in
step 6. </li>
<li>What is the purpose of the chkconfig command?</li>
<li>What is the purpose of the /etc/init.d/functions script?<br>
</li>

<li>What is the difference between the init and telinit commands?</li>
<li>What runlevels does Fedora 8 use and what is the purpose of each?</li>
<li>What is the purpose of the daemon and killproc functions?<br>
</li>
<li>What common arguments do startup scripts take? </li>
<li>How is a daemon different from a regular user process?</li>

<li>Where (what directory other than /proc) are process numbers
normally saved for
currently running daemons.</li>
<li>What is the purpose of the dot (.) command and where is it used
in this lab?</li>
<li>What is a lock file used for?</li>
<li>What is the full path name of the lock file used in this lab?<br>
</li>
</ol>
63
edits

Navigation menu