-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebtg
executable file
·67 lines (67 loc) · 1.46 KB
/
webtg
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
#!/bin/bash
rtdir=
def=
slx=
null=">/dev/null"
if [ -z "$matlab" ]; then
matlab=matlab
fi
prog=`which $matlab`
if [ $? -ne 0 ]; then
matlab=`which octave-cli`
if [ $? -ne 0 ]; then
matlab=octave
fi
fi
#find remtg directory
filename=`realpath $0`
MATLABPATH=`dirname $filename`
TMP=$HOME/tmp
ndumps="60"
usage="Usage: webtg [-o] [-O] [-v] [-t] [-d dir] [-s KSTVL2PZ] [-D def] [-x fig,subplot,routine] [-n dumps/secs] [start] | stop"
while getopts oOvtd:D:s:n:x: flag
do
case $flag in
v) null=;;
d) rtdir="$OPTARG";;
D) def="$OPTARG";;
x) slx="$OPTARG";;
s) EISCATSITE="$OPTARG"
export EISCATSITE;;
n) ndumps="$OPTARG";;
o) matlab="octave-cli";;
O) matlab="octave";;
t) TMP="$PWD";;
?) echo $usage
exit 2;;
esac
done
shift `expr $OPTIND - 1`
if [ ! -d $TMP ];then
mkdir $TMP
fi
if [ `echo $matlab | grep octave` ];then
TMPDIR=$TMP
OCTAVE_PATH=$MATLABPATH
export OCTAVE_PATH TMPDIR
else
export MATLABPATH TMP
fi
if [ "$*" = "stop" ];then
/bin/ps -u kstdev -u eiscat | awk '/webtg/ && ! /awk/ {print "ps -fu kstdev -u eiscat | grep " $1 " | grep $matlab"}' | /bin/sh | awk '{print $2}' | xargs kill -9 >/dev/null
elif [ "$*" = "start" ] || [ "$*" = "" ];then
WTG="wtg('$rtdir',$ndumps,'$def','$slx')"
SHELL=/bin/sh
export SHELL
unset DISPLAY
if [ -z "$OCTAVE_PATH" ];then
$matlab -nodisplay <<< "$WTG" $null
elif [ $matlab = "octave" ]; then
$matlab -q -p $OCTAVE_PATH <<< "$WTG"
else
$matlab -Wq <<< "$WTG"
fi
else
echo $usage
exit 1
fi