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 > Lessons > Lesson 5

 

Lesson 5 - Process Management

Required Reading

  1. Learning UNIX: Chapter 7 (Multitasking)
  2. WWW: Doing things periodically - Using cron
  3. WWW: Cron (event scheduler)

Additional Notes

Wondering what a daemon is?


Sometimes is is useful to see processes running on the entire system, not just for your user ID. The command to do this various for different UNIX varieties, but 'ps -ef' is common. Check 'man ps' to see a full list of options.


The concept of an interpreted program was brought up in the text discussion of the 'ps' command. An interpreted program is one that is not pre-compiled (like a C or C++ program), but rather is stored in it's "raw" format and is not independently executable. For a C program, once it's compiled you can execute it independently anywhere on the system. A perl program, however, is not self-sufficient. The perl interpreter (aka 'perl') is actually the command you run, and it reads the perl program and "interprets" it at run-time.

This has a couple of implications for webmasters:

  • every time a user runs a perl program, a new process will be started for the perl interpreter; you will see this if you monitor background processes
  • the perl interpreter must be on the system in a publicly-available space in order to run perl scripts (ie 'perl' must be readable and executable to all users in the system)

Cron can be very useful for webmasters if your server provides it. Any UNIX command can be automated via cron, such as copying your HTML files to a backup directory every night or sending an email to the webmaster with the day's usage statistics. Just take the exact command you type at the command line (including parameters and/or I/O redirection) and put it in the crontab file with the desired schedule.

To sum up the crontab commands:

crontab -l => list your current cron table

crontab -r => delete your current cron table

crontab -e => edit your cron table

crontab filename => import the file "filename" into your cron table

If you want to change your default editor (so that crontab -e uses something like pico instead of vi) you can follow these directions. ACC uses the bash shell.

And finally, read the message returned by crontab -l carefully when checking for cron access. The following message means you do not have access:

You are not allowed to use this program (crontab) See crontab(1) for more information

whereas this message means you do have access but do not yet have entries in your cron table:

no crontab for unixweb01

Next Step

Take the self-quiz

Complete project 4

Continue to lesson 6

 

 

Last update: 01-Feb-2005 0:13

 
About iTeachU
Programs Offerred
Library
Book Store
Other Resources

Course Access

 

 

 

Home > Continuing Education > UNIX > Lessons > Lesson 5

On-line Tutorials College Credit Continuing Ed. Certifications

 

info@iteachu.com

© Copyright 2001-2002 iTeachU All Rights Reserved