Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
848 dpurdie 1
#!/bin/sh
850 mhunt 2
#set -x
848 dpurdie 3
#
4
# buildtool     This shell script takes care of starting and stopping
5
#               buildtool.
6
#
7
# Note: This must be a 'sh' compatible script
8
#       Solaris8 uses sh to source the script. It is not run at startup
9
#
10
# Note: This file should be installed into /etc/init.d
11
#       May need addional configuration to add the file to the startup sequence
12
 
13
pid=0
14
 
15
#pid null if not running, pid if running
16
check_running() {
17
        pid=`ps -fe|grep java|grep abtdD.jar|awk '{print $2}'`
18
}
19
 
20
start() {
21
	# Start daemons.
22
        check_running
850 mhunt 23
	if [ "$pid" ]; then
848 dpurdie 24
          echo 'running'
25
        else
26
          echo 'starting'
894 mhunt 27
          su - buildadm -c 'source /etc/profile;unset GBE_PLATFORM;jats -NoExportVars eprog /home/buildadm/buildtool/abtlaunch 2>/tmp/buildtool 1>&2' &
848 dpurdie 28
	fi
29
}
30
 
31
stop() {
32
	# Stop daemons.
33
        check_running
34
        echo "check_running returned $pid"
35
 
850 mhunt 36
	if [ "$pid" ]; then
37
        for kpid in $pid ; do
38
            echo "killing $kpid"
39
            kill -9 $kpid 2>/dev/null 1>&2
40
        done
848 dpurdie 41
        else
42
          echo 'not running'
43
        fi
44
}
45
 
46
status() {
47
	# Stop daemons.
48
        check_running
49
 
850 mhunt 50
	if [ "$pid" ]; then
848 dpurdie 51
          echo 'running'
52
        else
53
          echo 'not running'
54
        fi
55
}
56
 
57
case "$1" in
58
  start)
59
	start
60
	;;
61
  stop)
62
	stop
63
	;;
64
  status)
65
	status buildtool
66
	RETVAL=$?
67
        ;;  
68
  restart)
69
       stop
70
       start
71
       ;;
72
 
73
  *)
74
	echo $"Usage: $0 {start|stop|restart|status}"
75
	exit 1
76
esac
77
 
78
exit $RETVAL