core dump checking script.

I was testing a program which crashing every now and then. It is very difficult in such scenarios to keep looking for the 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: 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 \”Core found\”

exit

else

echo \”continue\”

sleep 5

fi

done

fi

\"Reblog

About Amit Agarwal