Question
Create a script sends an email message to the user specified on the command line if any of the file systems at more than 60%
Create a script sends an email message to the user specified on the command line if any of the file systems at more than 60% of capacity. The script should not process special file systems as /proc on the ce.uml.edu. It should only process file systems which are either locally mounted or are mounted via NFS.
An individual email should be sent for each filey system which is at the warning level (60%) There should be a subject on the email with a message "Warning: File system
You may use any scripting language including /bin/sh, ksh, bash, awk or perl. Work done in the C-Shell (csh) will not be accepted. The same program for this assignment must be able to be run on both CE.UML.EDU and CYBERSERVER.UML.EDU
Please upload the script for the assigment. Do not upload a Word Document. I may run the script on either or both of the machines to verify your work.
Example output of the df -k command on CE.UML.EDU
Filesystem kbytes used avail capacity Mounted on /dev/dsk/c0t0d0s0 11089228 6593301 4385035 61% / /proc 0 0 0 0% /proc mnttab 0 0 0 0% /etc/mnttab fd 0 0 0 0% /dev/fd /dev/dsk/c0t0d0s5 6053358 1984237 4008588 34% /var swap 3701808 80 3701728 1% /var/run swap 3702784 1056 3701728 1% /tmp /dev/dsk/c0t1d0s7 39608035 13478135 25733820 35% /backups /dev/dsk/c0t1d0s0 30983686 4861760 25812090 16% /users /dev/dsk/c0t0d0s7 51379263 14579685 36285786 29% /space /space/local 51379263 14579685 36285786 29% /usr/local /space/opt/SUNWspro 51379263 14579685 36285786 29% /opt/SUNWspro
This command -T shows the file system types, so you would only process ufs on this system
: /usr/local/bin/df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/dsk/c0t0d0s0 ufs 11089228 6593301 4385035 61% / /dev/dsk/c0t0d0s5 ufs 6053358 1984246 4008579 34% /var swap tmpfs 3701720 80 3701640 1% /var/run swap tmpfs 3702696 1056 3701640 1% /tmp /dev/dsk/c0t1d0s7 ufs 39608035 13478135 25733820 35% /backups /dev/dsk/c0t1d0s0 ufs 30983686 4861760 25812090 16% /users /dev/dsk/c0t0d0s7 ufs 51379263 14579685 36285786 29% /space /space/local lofs 51379263 14579685 36285786 29% /usr/local /space/opt/SUNWspro lofs 51379263 14579685 36285786 29% /opt/SUNWspro
With that in mind on ce.uml.edu, you can run which will produce the correct file systems
: /usr/local/bin/df -t nfs -t ufs Filesystem 1K-blocks Used Available Use% Mounted on /dev/dsk/c0t0d0s0 11089228 6593301 4385035 61% / /dev/dsk/c0t0d0s5 6053358 1984246 4008579 34% /var /dev/dsk/c0t1d0s7 39608035 13478135 25733820 35% /backups /dev/dsk/c0t1d0s0 30983686 4861760 25812090 16% /users /dev/dsk/c0t0d0s7 51379263 14579685 36285786 29% /space
Example output of the dk -k command on CYBERSERVER.UML.EDU
Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/cyberserver-root 141716900 4354124 130266868 4% / udev 504896 12 504884 1% /dev tmpfs 102492 340 102152 1% /run none 5120 0 5120 0% /run/lock none 512452 0 512452 0% /run/shm /dev/sda1 233191 26961 193789 13% /boot ce.uml.edu:/users 30984192 4861952 25812992 16% /users ce.uml.edu:/space 51380224 14579712 36286464 29% /space
This command shows the filesystem types, you would process ext4, ext2 and nfs on this system
: df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/cyberserver-root ext4 141716900 4354120 130266872 4% / udev devtmpfs 504896 12 504884 1% /dev tmpfs tmpfs 102492 340 102152 1% /run none tmpfs 5120 0 5120 0% /run/lock none tmpfs 512452 0 512452 0% /run/shm /dev/sda1 ext2 233191 26961 193789 13% /boot ce.uml.edu:/users nfs 30984192 4861952 25812992 16% /users ce.uml.edu:/space nfs 51380224 14579712 36286464 29% /space
With that in mind on cyberserver.uml.edu, you can run
: df -t ext4 -t ext2 -t nfs Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/cyberserver-root 141716900 4354120 130266872 4% / /dev/sda1 233191 26961 193789 13% /boot ce.uml.edu:/users 30984192 4861952 25812992 16% /users ce.uml.edu:/space 51380224 14579712 36286464 29% /space
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