CT320 HW2: Automating processes
This homework assignment needs to be performed individually on the Linux
machines in the Linux Lab.
                
Purpose
Write a bash script to count:
- the number of non-root processes
- memory usage (percentage)
- number of logged-in users
on a lab machine over three consecutive days (72 hours).
                
Description of Task
Write a bash script that executes commands to count the number of
non-root processes, current memory usage percentage and the number of
logged-in users on a system. Memory usage percentage can be calculated
using the formula: current used memory ÷ total memory × 100%.
                
Set up this script to run once an hour over a three-day period.
This means you must have everything ready to run at least three days
before this due. Even then, you’re just hoping that everything goes
perfectly the first and only time—not really a winning strategy.
You live on the edge, sometimes, you fall off.
                
You must use crontab to handle the automatic timing for running the
script. In other words, you set up your script to be run by crond
at specific times, so that you don't have to get up at 4:00ᴀᴍ.
                
Run the script and record the information for each of the performance
tests. Make sure that the 3:00ᴘᴍ run doesn’t overwrite the 2:00ᴘᴍ data.
                
Disable your script by removing the crontab entry
after this assignment is done.
                
Graphs
Using any plotting facility you like, create the following six graphs:
                
Each of these, by the hour (72 tics on the X-axis):
- the number of non-root processes
- memory usage (percentage)
- number of logged-in users
Each of these, average by the day (three tics on the X-axis):
- the number of non-root processes
- memory usage (percentage)
- number of logged-in users
You may create your graphs by hand on
graph paper, if you can generate
a clean scan of your graph. A phone picture is not acceptable.
                
Debugging
If you encounter “STACK FRAME LINK OVERFLOW”, then try this:
export STACK_FRAME_LINK_OVERRIDE=ffff-ad921d60486366258809553a3db49a4a
Writeup
Create hw2.pdf
, perhaps via Microsoft Word or LibreOffice.
It must contain:
- the
crontab
entry that you used
- your script
- the plots
- a writeup, explaining your results. Why a peak here?
Why a valley there? Why do the values not go to zero?
If any of your results are strange or unexpected, discuss them
and discuss likely causes.
How to submit your homework:
Via web checkin, or:
                
~ct320/bin/checkin HW2 hw2.pdf
How to receive negative points:
Turn in someone else’s work.