.. $Id: index.rst 87 2007-10-11 22:46:18Z selfpace $ ====================== CS 9E - Assignment 1.3 ====================== ------------------ Process Management ------------------ .. :Last Updated: $Date: 2007-10-11 15:46:18 -0700 (Thu, 11 Oct 2007) $ Background ========== Overview -------- This assignment will give you an introduction to UNIX processes; you will learn how to find out information on and manage running tasks. Additionally, you will learn how to schedule processes to run automatically for you with cron and at. As of the creation of this assignment, however, at and cron are disabled on the instructional accounts for security concerns, so you won't actually be able to use them. We are in the process of talking to instructional support to find a solution. Reading ------- Das: Ch. 8 Assignment ========== Part 1 - Questions ------------------ Answer the following questions and bring them in for a tutor to evaluate: 1) What keystroke sequence do you execute to suspend a running terminal process that is in the foreground? 2) When terminating a process, why is it important to try 'kill' before doing 'kill -9'? Part 2 - Managing What's Running -------------------------------- Use 'script' (Section 2.8) to record your session, so you can show it to a tutor. 1) Execute the program 'cat' with no arguments. This will cause the program to wait for user input and appear to be a hung process. Pretend this actually IS a hung process and execute the necessary commands to do the following tasks from within the same session: a) Suspend the process b) Discover the process ID c) Kill the process 2) Again, execute the program 'cat' with no arguments and pretend it is a hung process. Login to your account in a separate session and execute the necessary commands to do the following: a) Discover the process ID b) Kill the process 3) Execute a command which will find all files in /usr/sww/opt and its subdirectories that contain the character sequence 'java' in their filename, and have this output stored to the file 'javafiles' in your home directory. This will take a while to finish, so make sure to have the process run in the background, so you can do other tasks while you wait. How can you verify that the process is still running? Part 3 - Crontab ---------------- Due to security restrictions, most of the instructional machines restrict usage of cron and at. Your cs9e accounts, however, are allowed to use these on one instructional machine. For this part of the assignment, you will need to use torus.cs.berkeley.edu Create a cron job which updates a web-accessible document every 15 minutes, http://inst.eecs.berkeley.edu/~/disk_usage.txt. This document should contain the time of last update and a summary of your disk quota usage. For example:: Mon Sep 11 14:13:34 PDT 2006 Disk quotas for cs9e-1 (uid 20620): Filesystem usage quota limit timeleft files quota limit timeleft /home/ff 17408 2147483644 2147483644 1089 -1 -1 You will need to show the tutor the crontab entry as well as the web output. By default, cron will e-mail your cs9e account every time a cron job runs. You should redirect this output to a file instead. For example, add the following to the END of your cron job:: >/home/ff/cs9e-xx/cronoutput 2>&1 Two hints: 1) You can see your quota usage with the 'quota' command. 2) You need to fully qualify all paths in a cron job. For example, if you wanted cron to run "ls ~/public_html/readme.txt", your cron job should say "/usr/bin/ls /home/ff/cs9e-xx/public_html/readme.txt". Assignment Checklist ==================== Part 1 ------ * Student correctly and intelligently answers all questions Part 2 ------ * Student correctly answers all questions and provides a transcript showing their interaction with the system Part 3 ------ * Student can adequately explain how cron works and how their page is being updated. * Student's web output is correct and updated hourly