Changes

Jump to: navigation, search

OPS435 Assignment 1 A

4,093 bytes added, 23:13, 13 February 2018
Created page with "Category:OPS435-PythonCategory:rchan =Assignment 1 - Users' Usage Report= '''Weight:''' 20% of the overall grade '''Due Date:''' Ask your professor for exact date '''L..."
[[Category:OPS435-Python]][[Category:rchan]]
=Assignment 1 - Users' Usage Report=
'''Weight:''' 20% of the overall grade
'''Due Date:''' Ask your professor for exact date
'''Late Penalty:''' 10% per school day, and note that this assignment must be completed satisfactorily in order to pass the course even if you get zero mark for this assignment.

==Overview==
Most system administrators would like to know the utilization of their systems by their users. On a Linux system, the users' login records are normally stored in the binary file /var/log/wtmp. The login records in this binary file can not be viewed or edited directly using normal Linux commands like 'less', 'cat', etc. The 'last' command is often used to display the login records stored in this file in a human readable form. The following listing is a sample output of running the 'last' command:
<pre>
$ last -F
rchan pts/0 :0 Mon Jan 8 22:40:02 2018 - Tue Jan 9 17:31:50 2018 (18:51)
rchan pts/0 :0 Mon Jan 8 21:47:32 2018 - Mon Jan 8 21:47:38 2018 (00:00)
rchan :0 :0 Mon Jan 8 21:46:36 2018 - Tue Jan 9 17:36:18 2018 (19:49)
(unknown :0 :0 Mon Jan 8 20:25:13 2018 - Mon Jan 8 21:46:36 2018 (01:21)
reboot system boot 3.10.0-514.10.2. Mon Jan 8 15:25:07 2018 - Fri Jan 12 01:31:18 2018 (3+10:06)
rchan :0 :0 Mon Jan 8 17:19:04 2018 - Mon Jan 8 17:34:29 2018 (00:15)
(unknown :0 :0 Mon Jan 8 16:48:02 2018 - Mon Jan 8 17:19:03 2018 (00:31)
reboot system boot 3.10.0-514.10.2. Mon Jan 8 11:47:56 2018 - Mon Jan 8 17:34:30 2018 (05:46)
rchan :0 :0 Mon Jan 8 13:55:51 2018 - Mon Jan 8 14:01:26 2018 (00:05)
(unknown :0 :0 Mon Jan 8 13:55:37 2018 - Mon Jan 8 13:55:51 2018 (00:00)
...
</pre>

In this assignment, your task is to create a python program with well designed functions to produce daily, weekly, and monthly usage report by user (and/or by other criteria) based on the information obtained from the 'last' command.

== Instructions ==

=== Program Name and valid command line arguments ===
Name your Python3 program as <code>usage_report.py</code>. The program should accept the following command line parameters:
* <b><code>--user</code></b> or <b><code>-u</code></b> as an optional first argument, followed by:
* <b><code>filename</code></b>, or
* <b><code>filename1 filename2 </code></b> etc ... - any number of filenames from 1 to as many as the command-line supports.

If the first argument is <b><code>--user</code></b> or <b><code>-u</code></b>, then you all the usage report should be by user only.

If there is no filename provided at the command line, your program should get the login records from the 'last' command with the appropriate flags.

If there is more than one filename provided, merged all the files together with the first one at the top and the last one at the bottom. Read and process the file contents in that order in your program.

=== Header ===

All your Python codes for this program must be placed in a single source file. Please include the following declaration by you as comment in your Python source code file (replace "Student Name" with your own name):

<source>OPS435 Assignment 1 - Winter 2018
Program: usage_report.py
Author: "Student Name"
The python code in this file (usage_report.py) is original work written by
"Student Name". No code in this file is copied from any other source
including any person, textbook, or on-line resource. I have not shared
this python program with anyone or anything except for submission for grading.
I understand that the Academic Honesty Policy will be enforced and violators
will be reported and appropriate action will be taken.
</source>

=== Main Menu ===

=== Daily Usage Menu ===

=== Weekly Usage Menu ===

=== Monthly Usage Menu ===

== Sample login records file ===

== Submission ==
After fully testing your program, submit the .py file on Blackboard
1,760
edits

Navigation menu