Question
Shell: Write a program called mchecker to check for new mail and write a message to the screen if new mail has arrived. a. The
Shell:
Write a program called mchecker to check for new mail and write a message to the screen if new mail has arrived.
a. The program will get the size of the mail spool file for the user. (The spool files are found in /var/spool/mail/$USER on Linux, Use the find command if you cannot locate the file.) The script will execute in a continuous loop, once every 30 seconds. Each time the loop executes, it will compare the size of the mail spool file with its size from the previous loop. If the new size is greater than the old size, a message will be printed on your screen, saying Username, You have new mail.
The size of a file can be found by looking at the output from ls l, wc c or from the find command.
Note: To test this, you can simply edit the spool file to add a new entry.
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