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 <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 ”Core found”
exit
else
echo ”continue”
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’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">
Related Articles:
- 2010/04/11 bash script to change vim colorscheme based on the available themes
- 2010/04/07 l-exp listrs – A new look at linux blogs and sites
- 2010/04/03 10 Keyboard Techniques To Create Cool Symbols
- 2010/04/01 There is only one reason left why Windows exists
- 2010/03/30 monkeystudio IDE on Fedora 12.. IDE of choice