core dump checking script.

2010-04-11 252 words 2 mins read

I was testing a program which crashing every now and then. It is very difficult in such scenarios to keep looking for the <a class="zem_slink" title="Core dump" rel="wikipedia" href="http://en.wikipedia.org/wiki/Core_dump">core file or keep checking for the running process. So I wrote this simple script that can check for core file in the particular path and keep running until it finds one. You can hack this script to send a mail once the core is found. This is a very simple script. And this should work on solaris too..

#!/bin/bash –

#===============================================================================

# FILE: check_core.sh

# USAGE: ./check_core.sh

# DESCRIPTION: Script to check for core dumps

# OPTIONS: —

# REQUIREMENTS: —

# BUGS: —

# NOTES: —

# AUTHOR: <a class="zem_slink" title="Digital Inspiration" rel="homepage" href="http://www.labnol.org">Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in

# COMPANY: Individual

# VERSION: 1.0

# CREATED: 12/14/2009 10:19:51 AM IST

# REVISION: —

#===============================================================================

path=/home/amit/

app_name=wine

app_pid=

[ -z $app_name ] || echo $app_name , pid_app=$(ps -u `whoami` -f|grep $app_name |grep -v grep)

[ -z $app_pid ] || echo $app_pid , pid_pid=$(ps -eaf|grep $app_pid |grep -v grep)

if [ -z $pid_app ]

then

while (true)

do

cd $path

if [ -f core ]

then

echo &#8221;Core found&#8221;

exit

else

echo &#8221;continue&#8221;

sleep 5

fi

done

fi<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c/">Handling out-of-memory conditions in C (eli.thegreenplace.net) <li class="zemanta-article-ul-li"><a href="http://r.zemanta.com/?u=http%3A//www.infoworld.com/d/developer-world/now-open-source-several-googles-javascript-tools-136%3Fsource%3Drss_infoworld_news&a=9258790&rid=b178fe33-18f0-4f94-85a2-35c508144f5f&e=a91b56994a3082f02dec48965dcc4052">Now open source: Several of Google&#8217;s JavaScript tools (infoworld.com) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/b178fe33-18f0-4f94-85a2-35c508144f5f/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e35.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it