CSCI A348/548
In-Lab Assignment One

Fall 2000


Due date
September 14, 11:59pm.
Late policy
To be announced. Please try to make the due date.
Work policy
Working in groups is encouraged but please turn in your own version of the assignment.
Task
Described in detail below.
Grading
Feedback will be provided within a week, grades will be posted on-line.
Graduate standing
The extra-credit part to the assignment that has to be turned in for graduate credit is composed of question 12 (at the end of the list).

Your first in-lab assignment consists of a few recommended activities and a check list:

1. Make sure you have the following directory structure under your home directory:

+-- bin ------ starthttpd 
|
+-- .cshrc
|
+-- .login
|
+-- httpd --+-- htdocs --+-- index.html
            |            |                
            |            +-- players ---+--- Reggie.html
            |            |              |
            |            |              +--- Jalen.html  
            |            |
            |            +-- a348 ---------- hw1 ------+------ file1.html 
            |            |                             |
            |            |                             +------ file2.html 
            |            |
            |            +-- images 
            |
            +-- conf ----+--- httpd.conf
            |            |
            |            +--- srm.conf   
            |            |
            |            +--- access.conf 
            |
            +-- logs ----+--- access_log 
            |            |
            |            +--- error_log 
            |            |
            |            +--- httpd.pid 
            |
            +-- cgi-bin ---- printenv 
            |
            +-- src
            | 
            +-- httpd
Note that you will have to create some files, while some already exist.

Be prepared to know what each one of the names in the hierarchy above stands for.

The file about Reggie Miller must have a bit of text about the player (not much) and his picture. Use this picture for Reggie Miller and this one for Jalen Rose. The files need to show the text and the picture at the same time.

The index.html file must show your picture. Make sure that the file that represents the picture is located in images in your server's Document Root.

2. The two files file1.html and file2.html should contain a description of the two programs sum and query in assignment 1. You need to include the complete source code and also to explain what the program does, as in the lecture notes.

3. Make sure your PATH contains the ~/bin directory. Here's a fragment from the relevant part of my ~/.cshrc file (it should be obvious where the file is):

set path = ( ~/bin  \
        /usr/local/gnu/bin \
4. You might also find it handy to set your default editor to something other than vi. Here's the relevant part in my ~/.login file (also located in my home directory):
# setenv EDITOR vi
setenv EDITOR pico

5. Set up your crontab entry. Here's a sample session in which we first check to see if there is any such file (-l) and we don't find any (because I deleted the one I created in lecture), then we create one (-e), list it, and finally remove it (-r), and check it.

burrowww.cs.indiana.edu% crontab -l
crontab: can't open your crontab file.
burrowww.cs.indiana.edu% crontab -e
burrowww.cs.indiana.edu% crontab -l
* 6 * * * /u/dgerman/bin/starthttpd
burrowww.cs.indiana.edu% crontab -r
burrowww.cs.indiana.edu% crontab -l
crontab: can't open your crontab file.
burrowww.cs.indiana.edu% 
6. Make sure your starthttpd works: use it without any switches, and with the -r and -k switches. Verify (by checking in the logs/errors.log) that it works as expected.

7. Access your web site a few times (including files from the players and a348/hw1 directories) and check to see of the logs/access.log has changed in any way as a result.

8. Start your server and stop it. List at least two or three ways of starting the server (that take and don't take into account the directory in which the command is issued). List also a few ways in which you can stop the server.

9. Make sure that your server is started and running. Check the contents of the logs/httpd.pid file. Then run ps -ef and pipe (|) that into grep httpd and then into grep username (where username is your username). Do you see anything that matches the contents of httpd.pid?

Here's this experiment for me:

burrowww.cs.indiana.edu% ps -ef | grep httpd | grep dgerman
 dgerman 10276  9925  0 03:01:52 pts/3    0:00 grep httpd
 dgerman 16765 16740  0   Sep 07 ?        0:00 /u/dgerman/httpd/httpd -d /u/dgerman/httpd
 dgerman 16872 16740  0   Sep 07 ?        0:00 /u/dgerman/httpd/httpd -d /u/dgerman/httpd
 dgerman 16740     1  0   Sep 07 ?        0:00 /u/dgerman/httpd/httpd -d /u/dgerman/httpd
 dgerman 21361 16740  0   Sep 08 ?        0:00 /u/dgerman/httpd/httpd -d /u/dgerman/httpd
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman
burrowww.cs.indiana.edu% cat httpd/logs/httpd.pid
16740
burrowww.cs.indiana.edu% 
10. Remove your httpd.pid and try to kill your server. Can you still do it? How?

11. What URL do you need to type to see the file1.html file?

12. Make printenv executable, then access it over the web. Explain what you see.


Last updated: September 9, 2000 by Adrian German for A348/A548