Ticket #10793: run.sh

File run.sh, 1.3 KB (added by Mark Spieth, 12 years ago)

sample script run debug mode mythcommflag in gdb

Line 
1#!/bin/bash
2
3PROG="/home/mark/debian/mythtv/git/mythtv/mythtv/programs/mythcommflag/mythcommflag"
4
5METHOD="--method all"
6CHAN=1001
7STARTTIME=20120507055900
8
9usage() {
10echo usage: $1 [opts] [chan starttime]
11}
12
13while : ; do
14        case "$1" in
15        -orig|--orig)
16                PROG=mythcommflag
17                unset METHOD
18                shift
19                ;;
20        -list|--list)
21                pushd /data/mythtv/recordings > /dev/null; for i in `ls -1tr 1*.mpg` ; do basename "$i" .mpg | tr _ ' ' ; done ; popd >/dev/null
22                exit 0
23                ;;
24        -*)
25                usage $0
26                exit 1
27                ;;
28        *)
29                break
30                ;;
31        esac
32done
33
34if [ -n "$1" ]; then
35        CHAN=$1
36        shift
37fi
38if [ -n "$1" ]; then
39        STARTTIME=$1
40        shift
41fi
42
43cat <<END > tmp.gdb
44set \$_exitcode = -999
45set height 0
46handle SIGTERM nostop print pass
47handle SIGPIPE nostop
48define hook-stop
49    if \$_exitcode != -999
50        quit
51    else
52        shell echo | mail -s "NOTICE: app has stopped on unhandled signal" root
53    end
54end
55echo tmp.gdb running app
56run --chanid $CHAN --starttime $STARTTIME --loglevel debug --outputmethod full $METHOD --outputfile output.txt -v commflag --nodblog --logpath . "$@"
57END
58
59#DEBUGCOMMFLAG=1 nice -19 $PROG --chanid $CHAN --starttime $STARTTIME --loglevel debug --outputmethod full $METHOD --outputfile output.txt -v commflag --nodblog --logpath . "$@"
60DEBUGCOMMFLAG=1 nice -19 gdb -x tmp.gdb $PROG
61
62#rm tmp.gdb