-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcolossus.in
116 lines (107 loc) · 2.82 KB
/
colossus.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
PID_FILE="colossus.pid"
PID_BACKUP="colossus.pid.bak"
BINDIR=`pwd`/servicios
if [ "$1" = "start" ] ; then
echo "Iniciando Colossus"
if [ -r $PID_FILE ] ; then
mv -f $PID_FILE $PID_BACKUP
fi
$BINDIR
sleep 10
if [ ! -r $PID_FILE ] ; then
echo "Se ha detectado un error en la ejecución de Colossus"
echo "====================================================="
echo "Comprueba todos los errores primero "
echo "====================================================="
echo "Si se ha generado un archivo .core, ejecute ./colossus backtrace"
echo "Diríjase a http://bugs.redyc.com/, abra un post y copie la información que se le ha mostrado entre las secciones INICIO y FIN";
echo "====================================================="
if [ -r $PID_BACKUP ] ; then
mv -f $PID_BACKUP $PID_FILE
fi
fi
elif [ "$1" = "stop" ] ; then
echo "Deteniendo Colossus"
kill -3 `cat $PID_FILE`
elif [ "$1" = "rehash" ] ; then
echo "Refrescando Colossus"
kill -1 `cat $PID_FILE`
elif [ "$1" = "restart" ] ; then
echo "Reiniciando Colossus"
kill -2 `cat $PID_FILE`
elif [ "$1" = "conectar" ] ; then
echo "Conectando con el servidor"
kill -13 `cat $PID_FILE`
elif [ "$1" = "version" ] ; then
$BINDIR -v
elif [ "$1" = "backtrace" ] ; then
if [ -d "modulos" ]; then
modpath="modulos"
elif [ -d "src/modulos" ]; then
modpath="src/modulos"
else
echo 'Ingrese la ruta de los modulos'
read modpath
if [ ! -d "$modpath" ]; then
echo "No es un directorio"
exit
fi
fi
# Find the corefile
echo "Escoja un core:"
n="0"
for i in `echo *core*`
do
ls -l $i
n=`expr $n + 1`
done
if [ "$n" -gt 1 ]; then
echo "Escriba el nombre del core que quiere examinar:"
read corefile
elif [ "$i" = "*core*" -o "$n" -eq 0 ]; then
echo 'No se encuentra ningun archivo core'
exit 1
else
corefile="$i"
fi
if [ ! -f "$corefile" ]; then
echo "No se encuentra el core '$corefile'"
fi
if [ ! -s "$corefile" ]; then
echo 'El archivo core esta vacio'
echo '(escriba "ulimit -c unlimited")'
exit 1
fi
(echo quit|gdb $BINDIR $corefile 2>&1)|\
grep -i 'no such file'|\
awk -F ':' '{ print $1 }'|sort|uniq|\
awk -F '.' "{ system(\"ln -s ../$modpath/\" \$2 \".so \" \$0) }"
echo ""
echo "=================== INICIO ======================"
echo "BACKTRACE:"
cat >gdb.commands << __EOF__
bt
echo \n
frame
echo \n
x/s backupbuf
echo \n
bt 5 full
quit
__EOF__
gdb -batch -x gdb.commands $BINDIR $corefile
rm -f gdb.commands
echo "GCC: `gcc -v 2>&1|tail -n 1`"
echo "UNAME: `uname -a`"
echo "COLOSSUS: `$0 version`"
echo "CORE: `ls -al $corefile`"
echo "=================== FIN ======================="
echo ""
echo "Copie lo que hay entre las secciones INICIO y FIN"
echo "y envielo a http://bugs.redyc.com/"
echo ""
echo "Gracias!"
else
echo "Uso: ./colossus start|stop|conectar|rehash|restart|version|backtrace"
fi