Files appear and disappear. It’s all so hard to follow. If only there were a program to help you keep track of things!
For this assignment, you will write a program called “
which helps you keep track of things. It can be a
bash script, a
perl script, or a
python3 script, but nothing else. This program is
useful for system monitoring.
It will tell you about any files underneath your home directory that
have appeared or vanished since the last time this program executed.
census output goes to standard output.
Only write to standard error for errors.
census would typically be executed from
cron, where the output
gets mailed to you. Of course,
census itself knows nothing about
census simply produces output or not.
emailing the output to you.
Here are some sample runs (
$ is my prompt):
$ cd $ ./census $ touch ~/tmp/alpha $ date >~/tmp/beta $ sleep 60 $ cd src $ echo "Hello" >>gamma $ ~/census New: -rw------- 1 ct320 class 6 Oct 16 15:13 src/gamma -rw------- 1 ct320 class 0 Oct 16 15:12 tmp/alpha -rw------- 1 ct320 class 29 Oct 16 15:12 tmp/beta $ rm ~/tmp/beta $ cp /etc/group ~/vote-for-jack-in-the-year-65535 $ ~/census Deleted: tmp/beta New: -rw------- 1 ct320 class 1021 Oct 16 15:13 vote-for-jack-in-the-year-65535 $ rm ~/tmp/alpha ~/vote-for-jack-in-the-year-65535 $ ~/census Deleted: tmp/alpha vote-for-jack-in-the-year-65535 $ ~/census $
~/.census-datadoes not exist, that means that this is the first run, so be silent.
~/.census-datato keep track of what’s there.
If you encounter “STACK FRAME LINK OVERFLOW”, then try this:
alphagets renamed to
beta, that’s the same as deleting
~/.census-data, which may be a file or a directory. Your program must create
~/.census-data, as needed. We won’t create it for you.
Use web checkin, or:
~ct320/bin/checkin HW5 census
How to receive negative points: