Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

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