ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Spectre2/Spectre2Control
Revision: 428
Committed: 2005-03-24T17:38:00-08:00 (20 years, 2 months ago) by douglas
File size: 1094 byte(s)
Log Message:
Finally, I can commit!

File Contents

# Content
1 #!/usr/bin/env bash
2 # Spectre 2
3 #
4 # Douglas Thrift
5 #
6 # $Id$
7
8 command="$1"
9
10 shift
11
12 function check()
13 {
14 pid="$($(dirname $0)/Spectre2 -pid $@)"
15 if [ "$pid" = "" ]; then
16 echo "not running."
17 exit
18 fi
19 }
20
21 function usage()
22 {
23 echo "Usage: $(basename $0) start|stop|restart|reload|status [...]"
24 }
25
26 function start_()
27 {
28 echo -n "Starting Spectre daemon ... "
29 if [ "$($(dirname $0)/Spectre2 -pid $@)" != "" ]; then
30 echo "already running."
31 exit
32 fi
33 $(dirname $0)/Spectre2 -fork $@
34 echo "started."
35 }
36
37 function stop_()
38 {
39 echo -n "Stopping Spectre daemon ... "
40 check $@
41 kill -TERM $pid
42 until [ "$($(dirname $0)/Spectre2 -pid $@)" == "" ]; do
43 sleep 0;
44 done
45 echo "stopped."
46 }
47
48 function restart_()
49 {
50 stop_ $@
51 start_ $@
52 }
53
54 function reload_()
55 {
56 echo -n "Reloading Spectre daemon ... "
57 check $@
58 kill -USR1 $pid
59 echo "reloaded."
60 }
61
62 function status_()
63 {
64 echo -n "Checking Spectre daemon ... "
65 check $@
66 echo "running with PID $pid."
67 }
68
69 case $command in
70 start)
71 start_ $@
72 ;;
73 stop)
74 stop_ $@
75 ;;
76 restart)
77 restart_ $@
78 ;;
79 reload)
80 reload_ $@
81 ;;
82 status)
83 status_ $@
84 ;;
85 *)
86 usage
87 ;;
88 esac

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Id