2008-10-03 19:06:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2009-01-29 23:01:25 +00:00
|
|
|
SCRIPT_BIN=`dirname $0`
|
2009-01-30 19:41:06 +00:00
|
|
|
. $SCRIPT_BIN/ceph_common.sh
|
2009-01-29 23:01:25 +00:00
|
|
|
|
2008-11-03 20:35:40 +00:00
|
|
|
daemon=0
|
2008-11-20 18:32:42 +00:00
|
|
|
valgrind=""
|
2008-10-15 21:01:22 +00:00
|
|
|
|
|
|
|
# explicit -n/--norestart?
|
2008-11-20 18:32:42 +00:00
|
|
|
while [ $# -ge 1 ]; do
|
|
|
|
case $1 in
|
2008-10-15 21:01:22 +00:00
|
|
|
-n | --norestart )
|
2008-11-20 18:32:42 +00:00
|
|
|
daemon=1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--valgrind )
|
|
|
|
valgrind="valgrind"
|
|
|
|
daemon=1
|
|
|
|
shift
|
|
|
|
;;
|
2009-01-29 23:01:25 +00:00
|
|
|
--conf_file )
|
|
|
|
startup_conf_file=$2
|
|
|
|
shift
|
|
|
|
;;
|
2008-11-20 18:32:42 +00:00
|
|
|
* )
|
|
|
|
break
|
|
|
|
esac
|
|
|
|
done
|
2008-10-15 21:01:22 +00:00
|
|
|
|
2009-01-29 23:01:25 +00:00
|
|
|
[ "$startup_conf_file" == "" ] && startup_conf_file="startup.conf"
|
|
|
|
CCONF="$CCONF_BIN --conf_file $startup_conf_file"
|
|
|
|
|
2008-10-03 19:33:26 +00:00
|
|
|
orig_args=$*
|
|
|
|
|
2008-10-15 21:01:22 +00:00
|
|
|
# implicit from any -d?
|
2008-10-03 19:33:26 +00:00
|
|
|
while [ $# -ge 1 ]; do
|
2008-10-15 21:01:22 +00:00
|
|
|
case $1 in
|
|
|
|
-d | --daemon )
|
|
|
|
daemon=1
|
|
|
|
esac
|
|
|
|
shift
|
2008-10-03 19:33:26 +00:00
|
|
|
done
|
|
|
|
|
2009-01-30 20:45:31 +00:00
|
|
|
core_sig[11]=1
|
|
|
|
core_sig[3]=1
|
|
|
|
core_sig[4]=1
|
|
|
|
core_sig[5]=1
|
|
|
|
core_sig[6]=1
|
|
|
|
core_sig[8]=1
|
|
|
|
|
|
|
|
|
2009-01-29 23:01:25 +00:00
|
|
|
get_conf_bool do_ulimit 0 "ulimit core" crun global
|
|
|
|
[ "$do_ulimit" != "0" ] && ulimit -c unlimited
|
|
|
|
|
2008-10-03 19:06:28 +00:00
|
|
|
while [ true ]; do
|
2008-11-20 18:32:42 +00:00
|
|
|
$valgrind $orig_args
|
2009-01-30 20:45:31 +00:00
|
|
|
exit_code=$?
|
2008-10-03 19:33:26 +00:00
|
|
|
[ $daemon -eq 1 ] && exit
|
2009-01-30 20:45:31 +00:00
|
|
|
|
|
|
|
if [ $exit_code -gt 128 ]; then
|
|
|
|
[ "${core_sig[$(($exit_code-128))]}" != "1" ] && exit
|
|
|
|
else
|
|
|
|
exit
|
|
|
|
fi
|
2008-10-03 19:06:28 +00:00
|
|
|
done
|