parsed.org

Tips by tag: tools

Building SQL in Query Tools by xinu on Jan 03, 2008 01:47 PM

You've got to build a query, but you're going to need bits of data from previous queries to do it. As you run the smaller queries, note the interesting value returned as a comment on the same line for use later:

select id_job from jobs where name like = '%foo%' -- 41319
select id_jobentry from jobentries where id_job = 41319

Thanks to McG for the tip.

aquacommentsqueriesquerysqltools
Simple swap monitor by mandric on Sep 25, 2007 06:32 PM

This is a simple swap monitor script:

#!/bin/bash
# Notify me one time if my swap is over MAXSWAP and log the
# swap usage as well in SWAPLOG.
# Usage: ./monitor.sh &

SWAPLOG=~/logs/monitor/swap
MAXSWAP=5
INTERVAL=30

send_sms_msg () {
  if [ "$1" ]; then STRING=$1; fi
  if [ $SMS_SENT ]; then
    return 0
  else
    echo $STRING | mailx -s 'monitor msg' 5101234567@cingularme.com
    SMS_SENT=1
  fi
}

while true; do
    # parse free output, get current swap value
    swaptest=`free -m |grep Swap|perl -pe 's/Swap:\s+\S+\s+(\S+).*/$1/'`
    if [ $swaptest -ge $MAXSWAP ]; then
        echo `date` Swap is: $swaptest >> $SWAPLOG
        send_sms_msg "Swap is: $swaptest"
    fi;
    sleep $INTERVAL
done;
bashmemorymonitorscriptshellswaptools
RSS