Problem

In this hands-on project, you configure a fake daemon process to execute upon system sta...

In this hands-on project, you configure a fake daemon process to execute upon system startup.

1. Once your system has booted, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of secret.

2. At the command prompt, type vi /etc/rc.d/init.d/sample and press Enter to create a fake daemon in the /etc/rc.d/init.d directory.

3. Enter the following information in the vi editor. When finished, save your changes and quit the vi editor. (Note: The variable $1 refers to the first argument given when executing the shell script on the command line.)

#!/bin/bash

if [ $1="start" ]

then

echo "The sample daemon has started"

sleep 2

elif [ $1="stop" ]

then

echo "The sample daemon has been stopped"

sleep 2

elif [ $1="restart" ]

then

echo "The sample daemon has been restarted"

sleep 2

fi

4. At the command prompt, type ls –l /etc/rc.d/init.d/sample and press Enter. What are the permissions on the file?

5. At the command prompt, type chmod 755 /etc/rc.d/init.d/sample and press Enter to allow the sample file to be executed.

6. At the command prompt, type ln -s /etc/rc.d/init.d/sample/etc/rc.d/rc5.d/ S50sample and press Enter. What does this command do? What will happen at system startup?

7. At the command prompt, type reboot and press Enter to reboot the system. When the graphical boot screen appears, press the Esc key on your keyboard. Pay close attention to the list of daemons as they are started. Does the sample daemon start? Why? Allow the system to boot normally.

8. When the system has booted successfully, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of secret.

9. At the command prompt, type service sample stop and press Enter. What happened?

10. At the command prompt, type service sample start and press Enter. What happened?

11. At the command prompt, type service sample restart and press Enter. What happened?

12. Type exit and press Enter to log out of your shell.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 8