#!/bin/bash DATETIME=$(date +"%Y%m%d-%H%M%S") CLUSTER=$(cat /etc/cluster) case "$CLUSTER" in turing) LOGDIR=$HOME/admin/login-patrol/turing ;; wahab) LOGDIR=$HOME/admin/login-patrol/wahab ;; *) echo "Error: unsupported cluster: $CLUSTER" >&2 exit 2 ;; esac whats_going_on () { date echo top -b -n 1 | head -n 60 | tee $LOGDIR/top-${DATETIME} echo ps fuxa > $LOGDIR/ps-fuxa-${DATETIME} cat $LOGDIR/ps-fuxa-${DATETIME} } if test -t 1; then whats_going_on | less else whats_going_on fi