Question
Create two shell scripts called signon and signoff that help you document your UNIX sessions. The scripts do NOT have to log you into or
Create two shell scripts called signon and signoff that help you document your UNIX sessions. The scripts do NOT have to log you into or out of a UNIX session -- just allow you to type in a remark. The signon and signoff scripts should be separate programs, that you run at different times.
When you run them, both signon and signoff scripts add lines to a history file called log.dat which continues to grow gradually. The idea here is to run the signon script to log the beginning of a work session and then later you run the signoff script to log the end of the session.
The signon script prompts you for a comment about the current session and then begins a new log entry in the log.dat file. Its output consists of a line of dashes, the word "Signon" with the date and time, and a 1-line comment about the session which it read esrlier.
The signoff script completes the new entry by appending the word "Signoff" with the date and time and another line of dashes.
After several signon/signoff sessions your log.dat file might look like this:
------------------------------------------------ Signon: Thu Oct 19 22:10:18 EDT 2017 Testing the signon program. Signoff: Thu Oct 19 22:10:27 EDT 2017 ------------------------------------------------ ------------------------------------------------ Signon: Thu Oct 19 22:12:38 EDT 2017 -- also testing the signoff program. Signoff: Thu Oct 19 22:12:46 EDT 2017 ------------------------------------------------
After you have your signon and signoff programs running, add the following enhancements:
1: Modify signon so that once you have signed on with it, if you try to sign on again it will just respond 'Already signed on' and not output to the log. Likewise modify signoff so that if you try to sign off twice it just responds the second time 'Not signed on' and not log anything. In other words, each program can figure out if you are currently signed on or not. 2: Modify signon so that it spawns a background process that wakes up and reminds you to signoff every 5 seconds or so. The background process should terminate as soon as you sign off.
Document your project carefully and be prepared to demonstrate it in the lab.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started