aboutsummaryrefslogtreecommitdiff
path: root/vo/java/app.topcat
blob: e69f9134ffc45a100b8cd09a028b29cb37a0e607 (plain) (blame)
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
#!/bin/csh -fx

unalias ps egrep java

set dir   = `dirname $0`
set me    = `whoami`
set pid   = `ps -fwu $me | egrep -i topcat | egrep -i Driver` 	#  MACHDEP
set npid  = $#pid
if ($npid == 0) then
    #  No TOPCAT running, check for a JSAMP/Aladin Hub.
    set pid   = `ps -fwu $me | egrep -i hub | egrep -i "jsamp|aladin"`
    set npid  = $#pid
    set is_topcat = 0
else
    set is_topcat = 1
endif

set jar   = topcat-full.jar


if ($#argv > 0) then
    if ("$1" == "-bg") then
        if ($npid == 0 && $is_topcat == 0) then
	    # No Hub running that we know about, clear out dreg .samp file.
            /bin/rm -rf ~/.samp
	endif
        exec ${dir}/topcat &

    else if ("$1" == "-kill") then
        kill -9 $pid[2]

    else if ("$1" == "-status") then
        if ($npid == 0 && $is_topcat == 0) then
	    echo "off"
        else
	    echo "on"
        endif

    endif
else
    if ($npid == 0 && $is_topcat == 0) then
	# No Hub running that we know about, clear out dreg .samp file.
        /bin/rm -rf ~/.samp
    endif
    exec ${dir}/topcat
endif