Skip to content

Instantly share code, notes, and snippets.

@corvax19
Created January 23, 2014 12:44

Revisions

  1. corvax19 created this gist Jan 23, 2014.
    21 changes: 21 additions & 0 deletions siebelCrashScanner.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/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 [email protected]

    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