Simple Bash script for reading size of Volume groupe.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Simple Bash script for reading size of Volume groupe.
Hey guys,
What is a simple bash script to read the size of a particular volume group and if that volumegroupe is at 50G big to send an email to user@mail.adress.com. I guess something like...
Then post back here when you've something you've tried and ask for help with it.
on CLI if i do a #df /dev/mapper/volgoruptest
it gives me the size of that voulme group and that is part of what i am looking for but how do i implement that on to a script? that says if this volumegroup is at 50G big than send an email to the mail server..
it gives me the size of that voulme group and that is part of what i am looking for but how do i implement that on to a script? that says if this volumegroup is at 50G big than send an email to the mail server..
Use awk or cut to get the used size and then compare that to the value for 50G (53687091200) and then use sendmail to send a mail.
Just quoting you what I'm normally paid to do linux admin stuff :P
See, wasn't so hard to go and copy some other script.
Oh, and by the way, your script is wrong, and not what you asked for.
You've gotta do what you gotta do. The main point to it was so i can get a preview of how it would look. I think thats been accomplished here. I just tried it on my test machine after tweaking it and it works great.
You've gotta do what you gotta do. The main point to it was so i can get a preview of how it would look. I think thats been accomplished here. I just tried it on my test machine after tweaking it and it works great.
The reason for asking is that the script you posted works on relative values (in your case % used) rather than the absolute value (50G) that you initially asked for.
If you're satisfied with the script that it solves your problem, please consider marking the thread as solved to help future searches see a solved issue they could possibly benefit from.
Perhaps also edit your last post to put [code][/code] tags around the code to separate it clearly and maintain any formatting.
Usually percentages are better anyway. Fairly similar to what I'd do except I'd have passed the volume and percentage as variables and fully pathed the commands to make it a bit more robust when used in cron
Usually percentages are better anyway. Fairly similar to what I'd do except I'd have passed the volume and percentage as variables and fully pathed the commands to make it a bit more robust when used in cron
Congratulations on getting there though.
Thanks, i just needed something imediate for now. But that is a good idea, i will disect this code on my own time to make it more robust like you said set variables and see if i can make it simpler. thank you for your input.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.