Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a script to determine whether a given file system or mount point is mounted, and output the amount of free space on the file

Write a script to determine whether a given file system or mount point is mounted, and output the amount of free space on the file system if it is mounted. If the file system is not mounted, the script should output an error. Vcloud plz idk what I did wrong

image text in transcribed

File Edit View Search Terminal Help min_free=4000 max_in use=55 # Get a list of all file systems. |filesystems='df -k | grep -v Use | grep - v none | awk '{print $6 }' for filesystem in $filesystems do # Cache results for this file system. entry='df -k $filesystem | tail -1 # Split out the amount of space free as well as in-use percentage. free='echo $entry | cut -d' ' -f4" in_use='echo $entry | cut -d' -f5 | cut-d'%' -fl' # Check the file system percent in use. if [ $(expr "$in_use > $max_in_use" ) ] then echo "$filesystem has only $free KB free at $in_use%." else # Check the available space against threshold. # Only make this check if the in use is OK. if grep -V "$mount"/proc/mounts; then echo "it's mounted." else echo "its not mounted." mount "$mount" if [ $? -eq 0 ]; then echo " Mount success!" else echo "Error" fi INSERT 43, File Edit View Search Terminal Help min_free=4000 max_in use=55 # Get a list of all file systems. |filesystems='df -k | grep -v Use | grep - v none | awk '{print $6 }' for filesystem in $filesystems do # Cache results for this file system. entry='df -k $filesystem | tail -1 # Split out the amount of space free as well as in-use percentage. free='echo $entry | cut -d' ' -f4" in_use='echo $entry | cut -d' -f5 | cut-d'%' -fl' # Check the file system percent in use. if [ $(expr "$in_use > $max_in_use" ) ] then echo "$filesystem has only $free KB free at $in_use%." else # Check the available space against threshold. # Only make this check if the in use is OK. if grep -V "$mount"/proc/mounts; then echo "it's mounted." else echo "its not mounted." mount "$mount" if [ $? -eq 0 ]; then echo " Mount success!" else echo "Error" fi INSERT 43

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago