Tag Info

Hot answers tagged

5

Don't reinvent the wheel :) The Monit utility is purpose-built to handle this sort of situation. It's well-documented and has plenty of examples here on ServerFault. check system kale.GreenLeaf.com if loadavg (5min) > 16 for 15 cycles then alert if memory usage > 92% then alert if swap usage > 10% then alert or for a process: ...


4

How about: [ $(free -m| grep Mem | awk '{ print int($3/$2*100) }') -gt "80" ] && echo "greater " || echo "lesser" And for the process consumption, here is a possible part of a solution: for p in $(pgrep bash); do total=$(($total + $(awk '/VmSize/ { print $2 }' /proc/$p/status))); done ; echo "Total memory usage: $total kb" ; unset total ...


2

To fit with modern sysadmin best practices it would be good to add your configs as individual files in /etc/smb/smb.d and then reference them with an include. Sadly samba does not support wildcard includes so you have to do add something like: include = /etc/smb/includes.conf in your smb.conf and then generate the includes.conf with something like: ls ...


2

What exactly are you trying to accomplish? You're probably trying to do it WRONG. [ $(free | perl -nE 'if (/Mem/) { (undef,$total,$used) = split; say int(100*$used/$total) }') -gt 80 ] && echo foo But note that whatever you are trying to accomplish with that is almost certainly useless (and probably even harmful). There is no such thing as ...


1

The difference might be the directory it's executed from. Maybe (probably) the system executes it not from inside the mount point with ./autorun.sh, but from somewhere else using an absolute path like /media/mykey/autorun.sh. To make the script work when executed from a different directory, using absolute path, write this way: #!/bin/sh cd "$(dirname ...



Only top voted, non community-wiki answers of a minimum length are eligible