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

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

Properties

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