Skip to content

Instantly share code, notes, and snippets.

View corvax19's full-sized avatar

romans.krjukovs corvax19

  • Riga, Latvia
  • 00:19 (UTC +03:00)
View GitHub Profile
@corvax19
corvax19 / SQLextract
Last active August 29, 2015 14:05
Extract SQL statements from Siebel logfiles
#!/usr/bin/awk -f
function help() {
print "Scripts detects and optionally extracts SQL statements among with "
print "binding variables and execution time from Siebel component's logfile."
print "Extraction is much slower - where applicable, run detection first"
print "to confirm there are interesting statements in the log."
print "TOP5 identified by following criterias:"
print " - most frequent statement"
print " - slowest statement"
print " - most time consuming statement (accumulated execution time)"
@corvax19
corvax19 / gist:4135359
Created November 23, 2012 12:15
Simple DNS resolve monitor with email notification #singleliner
ping -q -i1 -c3 target 2>&1|awk '/unknown host/{system("mailx -s \""$4" DNS resolution failed on `uname -n` at `date`\" bill.gates@microsoft.com >/dev/null")} /[:alpha:]/{S=S" "$0} END {print S}'
@corvax19
corvax19 / gist_weather.py
Last active December 9, 2015 23:39
gist_weather
from urllib import urlopen;
import json, sys;
url = "http://openweathermap.org/data/2.1/find/name?q=" + city;
t = json.load(urlopen(url))['list'][0]['main']['temp'] - 273.15;
print t;
@corvax19
corvax19 / topio.py
Created January 17, 2013 16:13
Script measures IO activity of the processes for a specified amount of time and return top list of those. Read, write or both IO operation could be measured and reported.
#!/usr/bin/python
import subprocess
import sys
import time
from optparse import OptionParser
def getOptionParser():
parser = OptionParser(version = '0.1_2012017',
description = '''Script measures IO activity of the processes for a specified amount of time
@corvax19
corvax19 / gist:5620021
Created May 21, 2013 14:04
fastcgi_module configuration example
LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
# URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
Alias /fcgi-bin/ /var/www/fcgi-bin/
# Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
<Directory /var/www/fcgi-bin/>
SetHandler fastcgi-script
@corvax19
corvax19 / gist:6129251
Created August 1, 2013 07:40
Recreating Siebel gateway service
1) Ensure the Siebel Server Service and Web Server services are offline
2) Run gtwysrvr\siebenv.sh
3) Stop the Gateway Server service (stop_ns)
4) Copy svc.gtwyns. in $SIEBEL_ROOT/gtwysrvr/sys to backup.svc.gtwyns.old
5) Delete the svc.gtwyns. file
6) Run the command siebctl -S gtwyns -a -g "/f $SIEBEL_ROOT/sys/siebns.dat /t 2320" substituting the port number for the Gateway Server service in place of 2320.
7) Start the Siebel Gateway service (start_ns)
8) Type list_ns
@corvax19
corvax19 / gist:6185251
Created August 8, 2013 14:49
Curl command and data in single script
#!/bin/bash
/opt/local/bin/curl -v -H 'Content-Type: application/json' -X POST http://echo.httpkit.com -d @- <<'EOF'
{"test": 123, "aaa": 333}
EOF
@corvax19
corvax19 / logApacheWorkerPIDs.sh
Created November 19, 2013 09:50
Log Siebel web server's workers PIDs. server-status section to be enabled in httpd.conf.
((date; curl -s localhost:7777/server-status|grep '<tr><td>'|sed -r 's/.*<\/b><\/td><td>([0-9]{2,}).*/\1/g'|sort|uniq)|tr '\n' '|'; echo) >> /tmp/apache.pids
@corvax19
corvax19 / findSiebelServerLogfile.sh
Created January 23, 2014 11:27
How to find log filename of the Siebel enterprise server running on the server for given user ?
USER='siebel' lsof -u $USER -a -c siebsvc|grep -e '.*\.log$'|awk '{print $(NF)}'
@corvax19
corvax19 / siebelCrashScanner.sh
Created January 23, 2014 12:44
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)"