Skip to content

Instantly share code, notes, and snippets.

@corvax19
Created January 23, 2014 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corvax19/8577932 to your computer and use it in GitHub Desktop.
Save corvax19/8577932 to your computer and use it in GitHub Desktop.
Looks for running siebel enterprise server log file of given system user and scans previous hour for signs of process crashes.
#!/bin/env bash
# Looks for running siebel enterprise server log file
# of given system user and scans previous hour for signs of process crashes.
#
# 20140123 romans.krjukovs@gmail.com
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <user> <tz> [-verbose]"
echo " user - system user running Siebel enterprise"
echo " tz - adjusted timezone to cover previous hour (CET+0)"
echo " -verbose - for verbose positive output with timestamp and used logfile name"
exit 1
fi
LOG=`/usr/sbin/lsof -c siebsvc|grep -e ".*$1.*\.log$"|awk '{print $(NF)}'`
if [ X"$LOG" = X ]; then
echo "ERROR: Siebel enterprise server's log file is not found for user $1!"
exit 2
fi
TS=`TZ=$2 date +"%Y-%m-%d %H:"`
egrep '.*ProcessExit.*$TS.*' $LOG|grep -v SUCCESS||\
if [ "$#" -eq 3 ]; then echo "OK: $TS:xx:xx $LOG"; else echo "OK"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment