3 # if we start up as ./init-ceph, assume everything else is in the
4 # current directory too.
5 if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
11 LIBEXECDIR=@libexecdir@/ceph
12 ETCDIR=@sysconfdir@/ceph
15 BINDBGDIR="/usr/lib/debug/usr/bin"
18 echo "usage: $0 [-c ceph.conf] <filename.tar.gz>"
25 for i in $(seq 10); do
26 [ -e /proc/$pid ] || return
29 if [ -e /proc/$pid ]; then
35 . $LIBEXECDIR/ceph_common.sh
38 while [ $# -ge 1 ]; do
41 [ -z "$2" ] && usage_exit
46 if [ -n "$dest_tar" ]; then
47 echo unrecognized option \'$1\'
56 [ "$dest_tar" = "" ] && usage_exit
58 echo "$0: generating debugpack tarball..."
60 if [ -e $dest_tar ]; then
61 echo "$0: dest $dest_tar already exists, aborting"
65 # get absolute path for dest_tar
66 bins="ceph-mon ceph-mds ceph-osd radosgw"
67 core_paths="/ $BINDIR $BINDBGDIR"
68 [ "$conf" = "" ] && conf=$ETCDIR/ceph.conf
69 log_path=`$CCONF -c $conf "log dir"`
71 [ -z "$conf" ] && usage_exit
78 if [ -e "/usr/bin/$bin" ]; then
79 files="$files /usr/bin/$bin"
81 if [ -e "/usr/lib/debug/usr/bin/$bin" ]; then
82 files="$files /usr/lib/debug/usr/bin/$bin"
86 # logs (the non-rotated ones)
87 for f in `find $path -maxdepth 1 -name 'core*'`; do
91 # copy cores (if exist)
92 for path in $core_paths; do
94 for f in `find $path -maxdepth 1 -name 'core*'`; do
101 tmp_path=`mktemp -d /tmp/ceph-debugpack.XXXXXXXXXX`
103 $BINDIR/ceph report > $tmp_path/ceph-report &
106 files="$files $tmp_path"
108 # now create a tarball
109 tar cvfz $dest_tar $files
112 echo "$0: created debugpack tarball at $dest_tar"