Course: ITNW6088 UNIX for Webmasters
Instructor:
Ashley Rosilier unix@iteachu.com

Dates: Jan. 31 - Mar. 11

Class Quick Links
Syllabus Roster Grades Schedule Forums Chat Lessons Projects
Class is self-paced
 
On-line Tutorials College Credit Continuing Ed. Certifications

Home > Continuing Education > UNIX > Projects > Project 4

 

Project 4 - Process Management

Due Date - [an error occurred while processing this directive]

Preparation

Objectives

  • Monitor the status of various processes
  • Understand the use of cron

Project Details

Task Command Comments
See what processes are currently running ps Notice that you will at least see an entry for the 'ps' command and for the shell (on ACC servers, that is 'bash')
Start the 'sleep' command

sleep 10000

This command just makes the terminal wait the specified number of seconds. Notice that you can't type any commands while it's running.
Cancel the command

CTRL-C

The command is interrupted and is no longer running.
See what processes are currently running
ps
You should not see 'sleep' still running
Start the 'sleep' command

sleep 10000

This command just makes the terminal wait the specified number of seconds. Notice that you can't type any commands while it's running.
Now, suspend the process

CTRL-Z

This suspends the sleep command and brings you back to the prompt
See what processes are currently running
ps
You should see the 'sleep' command as well as the ones you previously saw.
Put the suspended command into the background

bg

The 'sleep' command continues in the background. Hit enter a few times and you will see it complete.
Start the 'sleep' command in the background

sleep 10000&

Now you are automatically putting the command in the background. Notice that you are shown the PID and immediately returned to the command prompt.
See what processes are currently running
ps
You should see the 'sleep' command as well as the ones you previously saw.
Kill the process kill PID Replace PID with the process ID you saw when you started the 'sleep' command.
See what processes are currently running
ps
You should not see 'sleep' still running.

 

Task Command Comments
Create a crontab entry to print "Hello world" to the file "hello.txt" every minute
crontab -e

You will be put into the vi editor automatically. It looks like a blank page with a bunch of tilde characters (~) down the left hand side.

Remember to type "i" to enter insert mode Review the vi overview if you need to.

Insert the following line:

* * * * * echo "Hello world" >> /home/XXX/hello.txt

Replace XXX with the remainder of the path to your home directory. (Ex: /home/unixweb/unixweb01/hello.txt)

Make sure you type this all on one line, with spaces between the asterisks.

Type ESC :wq to quit vi and save the crontab entry.

Confirm your new entry crontab -l

The paramter is a lower-case L, not the number one.

You should see the line you just typed.

Wait a few minutes    
View the hello.txt file cat hello.txt You should see several copies of "Hello world".
Remove the crontab entry. crontab -r This will delete all crontab entries for your user ID. If you need to selectively delete entries, you must edit the crontab.
Confirm you have no crontab entry crontab -l Your crontab should be empty.


Task to be completed What you need to submit via email

Above exercises (Note that the second exercise requires crontab access. It will work on the ACC server)

copy of telnet session text

Answer the following question:

What would the crontab entry be to do the following?

  • Append a file in your home directory called "who.txt" with an alphabetical list of all users logged onto the system
  • Record any errors in a file called "cron.err" in your home directory
  • Do this update at 3:00 am every Wednesday in December

The answer should be a single contab entry to accomplish all three components.

answer

Project Submission

In order to submit your project, you will need to be able to copy the command results from your telnet session. You can either copy the entire session or just the relevent parts. Email the text from your telnet session, along with any other information requested, to unix@iteachu.com by the deadline date in the schedule.

 

 

Last update: 11-Oct-2004 22:38

 
About iTeachU
Programs Offerred
Library
Book Store
Other Resources

Course Access

 

 

 

Home > Continuing Education > UNIX > Projects > Project 4

On-line Tutorials College Credit Continuing Ed. Certifications

 

info@iteachu.com

© Copyright 2001-2002 iTeachU All Rights Reserved