Sunday, February 19, 2012

SSL cert Expiry Date

Why to depend on some sites for this - be a geek and use your Bash Shell ^_^

[root@DebaTestBox ~]# openssl s_client -showcerts -connect mySite.com:443 > mySite.cert < / dev / null

[root@DebaTestBox ~]# openssl x509 -in mySite.cert -text -noout | awk '/After/ || /DNS/'
Not After : Feb 9 01:21:59 2013 GMT

[root@DebaTestBox ~]#

Thanks/-
DK

GoLive Checklist

Usually we start a project against a SOW(Statement Of Work) and until goLive or final Beta testing we do a lot of communication back and forth to respective BU and try to make sure things at our end is perfect and communication keeps flowing. BUT running behind various deadlines we feel to have a checklist just to make sure things are still looking tidy and various servers for the said project is healthy and hardened enough to face the cruel(!) traffic.

Please find this link to download my GoLive checklist!

[***Download here***]

Hope it helps!

-DK

Wednesday, October 12, 2011

MSSQL error logs in *nix boxes

Today we had to parse one SQL error log file in UNIX box and I saw a kind diff file format -

#grep "Database mirroring is inactive" ERRORLOG.1

And i saw no output. :-(

I thought its dos2unix which can help me. BUT not!!

#file ERRORLOG.4


ERRORLOG.4: Little-endian UTF-16 Unicode English character data, with very long lines, with CRLF line terminators


grep command couldn’t parse the UTF-16 Unicode file. Hence, the file had to be converted to the format which ‘grep’ can parse.

#iconv -f UTF-16 -t UTF-8 ERRORLOG.1 | grep "Database mirroring is inactive"

And cheers! I am done.

-DK

Tuesday, August 23, 2011

Our new little angel..

We've added another color to our family's rainbow... we have named her 'Srishti' . She may be small when it comes to size, but she's the queen of the cutie pies! And very naughty alrerady... :-)

"A Precious one,
So small,
and So cute..

Dancing in
her angel feet
Straight from Heaven's
brightest star..

What a miracle
you are! "



- Delighted Parents
Debajit & Nandita

Saturday, August 6, 2011

Recover deleted /var/log/messages

I had to handle a recent escalation where /var reportedly got filled up - Someone with 'dbuser' userid deleted /var/log/message file on this server

[root@vapdb01 ~]# last

dkataki pts/0 10.152.208.19 Sat Aug 6 20:46 still logged in

dbuser pts/0 10.152.208.19 Sat Aug 6 20:14 - 20:22 (00:08)

dbuser pts/0 10.152.208.19 Fri Aug 5 04:17 - 10:08 (05:51)

This is how I would tackle this situation

[root@vapdb01 ]# df -h | grep /var

/dev/xvda3 3.0G 2.5G 282M 91% /var

[root@vapdb01 ]# cd /var

[root@vapdb01 var]# du -csh .

347M .

347M total

Looks like some file got deleted but some pid is still holding this file --

[root@vapdb01 var]# lsof | grep -i deleted | grep "/var/"

syslogd 1404 root 2w REG 202,3 2230328164 503883 /var/log/messages (deleted)

gpnpd.bin 4948 oracle 17uw REG 202,3 0 31522 /var/tmp/.oracle/ora_gipc_GPNPD_vapdb01_lock (deleted)

ocssd.bin 5013 oracle 17uw REG 202,3 0

That means someone tried to clear /var partition and deleted unknowingly or accidentally a crucial file from the server - and size of the file was - 2.1G+ , good catch but wrong measure by the user i would say!!!

Anyway - time to avert this situation now -

[root@vapdb01 var]# cat /proc/1404/fd/7 > /root/messages.1

[root@vapdb01 var]# /etc/init.d/syslog restart

[root@vapdb01 var]# cd /root/

[root@vapdb01 var]# gzip messages.1

[root@vapdb01 ~]# mv messages.1.gz /var/log/

[root@vapdb01 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/xvda2 14G 4.5G 8.2G 36% /

/dev/xvda3 3.0G 434M 2.4G 16% /var

..and a happy Ending -

This only can someone do who has little knowledge on how UNIX works. Shame!! Is not that why we SA folks are very careful while giving root privilege to normal users?

-DK

Monday, May 30, 2011

history

Its always handy to capture the timestamp in your server's  history for audit purpose.

This is how it can be enabled.

Open ~/.bashrc file.

export HISTTIMEFORMAT="%h/%d - %H:%M:%S "



Some of my Favorite key on shell is :

Ctrl + r

Ctrl + p

history -c (Dangerous! It will wipe off entire history) , useful sometime for some victors ^_^ though..!!

Enjoy!
DK

  🔭 First Impression: Exploring Grafana Mimir              ... After Years with Thanos! Not an observability( OE ) purist, but I do appreci...