source: tags/cvs_2_svn/SH/arb_panic

Last change on this file was 5455, checked in by anonymous, 16 years ago

This commit was manufactured by cvs2svn to create tag 'cvs_2_svn'.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1#!/bin/sh
2
3err () {
4        echo "*********** ERROR **********" 1>&2
5        echo "`basename $0`: $@" 1>&2
6        exit 1
7}
8
9seperator() {
10        echo ''
11        echo '*****************************'
12}
13
14chooser="/tmp/arb_pids_${USER}_*"
15
16echo '*****************************'
17echo "********* P A N I C *********"
18echo '*****************************'
19echo ""
20echo "  This Module tries to save a running database"
21echo "  There may be more than database server (ARB_NT):"
22echo "          --------------------------------"
23
24for i in $chooser ; do
25        /bin/echo "             - >" `ls $i` "<";
26done
27echo "          --------------------------------"
28
29echo "Please choose one line and enter the rightmost number"
30
31read ARB_PID
32if [ ! -f /tmp/arb_pids_${USER}_${ARB_PID} ]; then
33        err "Incorrect Choice"
34fi
35
36seperator
37echo "Please enter file name (full path):"
38read FILE
39
40panicfile="/tmp/arb_panic_${USER}_${ARB_PID}"
41rm -f $panicfile
42echo "$FILE" >$panicfile
43ok=false
44for i in `cat /tmp/arb_pids_${USER}_${ARB_PID}`; do
45        if kill -1 $i 2>/dev/null; then
46                ok=true
47                break
48        fi
49done
50if [ "$ok" = "false" ]; then
51        err     "Sorry could not find a running server"
52fi
53seperator
54echo "Wait until database is saved (1000 sequences == 1min ) or press <ctrl-c> to abort"
55while [ -f $panicfile ]; do
56        sleep 1
57        echo "          waiting"
58done
59
60seperator
61echo "enter 'kill' if you want to kill the server and its clients"
62read ki
63if [ "$ki" = "kill" ] ; then
64        arb_clean
65fi
Note: See TracBrowser for help on using the repository browser.