Question: Create a shell script, fs_usage_warning that sends email to users when a file system is above certain disk usage percentage. You would check against the
Create a shell script, fs_usage_warning that sends email to users when a file system is above certain disk usage percentage.
You would check against the Use% of the df command. fs_usage_warning [-c capacity-percentage] email-address [email-address]
You can specify more than one email address separate by spaces o the email address can just be an account name or a complete email address
If no email addresses are specified, the programs should exit with an error.
If the -c capacity-percentage is not specified, it should default to 60%. o You do not specify the % on the capacity-percentage
If the file system is less than the specified amount, no mail message is sent. If the file system is greater than or equal to the specified amount and less than 90%, the mail message should have the following subject: Warning: the file system is above % used The message body should have complete disk usage line from the df command for that file system along with the header. No other file systems should be in the mail message.
If the file system is greater than or equal to 90%, the mail message should have the following subject: Critical Warning: the file system is greater than or equal to 90% capacity
The message body should have complete disk usage line from the df command for that file system along with the header. No other file systems should be in that mail message. You are required to use the mailx command and in-line redirection (here-document) to send the email. Temporary files are not allowed.
Must use in-line redirection.
A separate email message should be sent for each file system that meets the warning capacity requirements.
The student should use the df command and process the output of the df command and only process these file system types, nfs, ext4 and ext2. df -k -t nfs -t ext4 -t ext2 Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/cyberserver-root 141786532 5874056 128816568 5% / /dev/sda1 233191 49878 170872 23% /boot ce-srv-02:/export/space/ 38113280 4802560 33310720 13% /space ce-srv-02:/export/home/ 35976192 2665472 33310720 8% /users
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
