Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
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.
Hi..i am leonard a new member here..
My question is,
If in a file system, the capacities has reached 80%, is there any alert message to user? If is exist, I wish to make it in a script then I implement into crontab
thank u
Of course you can set up alerting for this and many other things.
That could be as sophisticated as a full system (like Nagios with NRPE plugins) or as simple as scripting:
Code:
#!/bin/bash
while true do
HOMEPCT=`/bin/df /home |/bin/grep /home |awk '{print $5}' |cut -d% -f1`
if [ $HOMEPCT -ge 80 ]
then echo "The filesystem is now at ${HOMEPCT}% | /bin/mail -s "Space Alert on /home" yourmailname@yourmaildomain
/bin/sleep 60
done
The above would check every minute and email you if the space had reached or exceeded 80%. You can change /home to whatever you want or put in multiple lines for each run.
I did say it was a "simple" script. It will only email when the filesystem has reached 80%. You're correct that it would email you every minute thereafter.
One COULD put logic in to limit it to so many emails per hour but I wasn't trying to provide a full monitoring solution - just showing that it could be done. I think were it me I'd rather risk being spammed to know my FS was about to be full than to wait to look in the log file AFTER it was full.
As for me I use Nagios with NRPE plugins which was my first suggestion above.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.