microwave 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/Rakefile +4 -4
  2. data/bin/chef-solo +2 -0
  3. data/spec/spec_helper.rb +2 -0
  4. data/spec/unit/checksum/storage/filesystem_spec.rb +4 -4
  5. data/spec/unit/config_spec.rb +7 -4
  6. data/spec/unit/data_bag_spec.rb +11 -11
  7. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +8 -8
  8. data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +5 -5
  9. metadata +10 -124
  10. data/distro/README +0 -2
  11. data/distro/arch/etc/conf.d/chef-client.conf +0 -5
  12. data/distro/arch/etc/conf.d/chef-expander.conf +0 -8
  13. data/distro/arch/etc/conf.d/chef-server-webui.conf +0 -10
  14. data/distro/arch/etc/conf.d/chef-server.conf +0 -10
  15. data/distro/arch/etc/conf.d/chef-solr.conf +0 -8
  16. data/distro/arch/etc/rc.d/chef-client +0 -90
  17. data/distro/arch/etc/rc.d/chef-expander +0 -78
  18. data/distro/arch/etc/rc.d/chef-server +0 -78
  19. data/distro/arch/etc/rc.d/chef-server-webui +0 -78
  20. data/distro/arch/etc/rc.d/chef-solr +0 -78
  21. data/distro/common/html/chef-client.8.html +0 -145
  22. data/distro/common/html/chef-expander.8.html +0 -164
  23. data/distro/common/html/chef-expanderctl.8.html +0 -146
  24. data/distro/common/html/chef-server-webui.8.html +0 -185
  25. data/distro/common/html/chef-server.8.html +0 -182
  26. data/distro/common/html/chef-solo.8.html +0 -191
  27. data/distro/common/html/chef-solr.8.html +0 -165
  28. data/distro/common/html/knife-bootstrap.1.html +0 -241
  29. data/distro/common/html/knife-client.1.html +0 -219
  30. data/distro/common/html/knife-configure.1.html +0 -170
  31. data/distro/common/html/knife-cookbook-site.1.html +0 -241
  32. data/distro/common/html/knife-cookbook.1.html +0 -384
  33. data/distro/common/html/knife-data-bag.1.html +0 -238
  34. data/distro/common/html/knife-environment.1.html +0 -267
  35. data/distro/common/html/knife-exec.1.html +0 -134
  36. data/distro/common/html/knife-index.1.html +0 -125
  37. data/distro/common/html/knife-node.1.html +0 -250
  38. data/distro/common/html/knife-recipe.1.html +0 -92
  39. data/distro/common/html/knife-role.1.html +0 -200
  40. data/distro/common/html/knife-search.1.html +0 -288
  41. data/distro/common/html/knife-ssh.1.html +0 -156
  42. data/distro/common/html/knife-status.1.html +0 -128
  43. data/distro/common/html/knife-tag.1.html +0 -137
  44. data/distro/common/html/knife.1.html +0 -320
  45. data/distro/common/html/shef.1.html +0 -283
  46. data/distro/common/man/man1/knife-bootstrap.1 +0 -201
  47. data/distro/common/man/man1/knife-client.1 +0 -99
  48. data/distro/common/man/man1/knife-configure.1 +0 -88
  49. data/distro/common/man/man1/knife-cookbook-site.1 +0 -145
  50. data/distro/common/man/man1/knife-cookbook.1 +0 -345
  51. data/distro/common/man/man1/knife-data-bag.1 +0 -136
  52. data/distro/common/man/man1/knife-environment.1 +0 -178
  53. data/distro/common/man/man1/knife-exec.1 +0 -46
  54. data/distro/common/man/man1/knife-index.1 +0 -29
  55. data/distro/common/man/man1/knife-node.1 +0 -134
  56. data/distro/common/man/man1/knife-role.1 +0 -88
  57. data/distro/common/man/man1/knife-search.1 +0 -280
  58. data/distro/common/man/man1/knife-ssh.1 +0 -79
  59. data/distro/common/man/man1/knife-status.1 +0 -29
  60. data/distro/common/man/man1/knife-tag.1 +0 -43
  61. data/distro/common/man/man1/knife.1 +0 -288
  62. data/distro/common/man/man1/shef.1 +0 -256
  63. data/distro/common/man/man8/chef-client.8 +0 -104
  64. data/distro/common/man/man8/chef-expander.8 +0 -97
  65. data/distro/common/man/man8/chef-expanderctl.8 +0 -62
  66. data/distro/common/man/man8/chef-server-webui.8 +0 -155
  67. data/distro/common/man/man8/chef-server.8 +0 -147
  68. data/distro/common/man/man8/chef-solo.8 +0 -158
  69. data/distro/common/man/man8/chef-solr.8 +0 -122
  70. data/distro/common/markdown/README +0 -3
  71. data/distro/common/markdown/man1/knife-bootstrap.mkd +0 -141
  72. data/distro/common/markdown/man1/knife-client.mkd +0 -103
  73. data/distro/common/markdown/man1/knife-configure.mkd +0 -70
  74. data/distro/common/markdown/man1/knife-cookbook-site.mkd +0 -123
  75. data/distro/common/markdown/man1/knife-cookbook.mkd +0 -263
  76. data/distro/common/markdown/man1/knife-data-bag.mkd +0 -121
  77. data/distro/common/markdown/man1/knife-environment.mkd +0 -151
  78. data/distro/common/markdown/man1/knife-exec.mkd +0 -37
  79. data/distro/common/markdown/man1/knife-index.mkd +0 -30
  80. data/distro/common/markdown/man1/knife-node.mkd +0 -130
  81. data/distro/common/markdown/man1/knife-role.mkd +0 -85
  82. data/distro/common/markdown/man1/knife-search.mkd +0 -180
  83. data/distro/common/markdown/man1/knife-ssh.mkd +0 -69
  84. data/distro/common/markdown/man1/knife-status.mkd +0 -36
  85. data/distro/common/markdown/man1/knife-tag.mkd +0 -39
  86. data/distro/common/markdown/man1/knife.mkd +0 -218
  87. data/distro/common/markdown/man1/shef.mkd +0 -189
  88. data/distro/common/markdown/man8/chef-client.mkd +0 -74
  89. data/distro/common/markdown/man8/chef-expander.mkd +0 -82
  90. data/distro/common/markdown/man8/chef-expanderctl.mkd +0 -58
  91. data/distro/common/markdown/man8/chef-server-webui.mkd +0 -121
  92. data/distro/common/markdown/man8/chef-server.mkd +0 -121
  93. data/distro/common/markdown/man8/chef-solo.mkd +0 -107
  94. data/distro/common/markdown/man8/chef-solr.mkd +0 -89
  95. data/distro/debian/etc/default/chef-client +0 -4
  96. data/distro/debian/etc/default/chef-expander +0 -8
  97. data/distro/debian/etc/default/chef-server +0 -9
  98. data/distro/debian/etc/default/chef-server-webui +0 -9
  99. data/distro/debian/etc/default/chef-solr +0 -8
  100. data/distro/debian/etc/init.d/chef-client +0 -210
  101. data/distro/debian/etc/init.d/chef-expander +0 -176
  102. data/distro/debian/etc/init.d/chef-server +0 -122
  103. data/distro/debian/etc/init.d/chef-server-webui +0 -123
  104. data/distro/debian/etc/init.d/chef-solr +0 -176
  105. data/distro/debian/etc/init/chef-client.conf +0 -17
  106. data/distro/debian/etc/init/chef-expander.conf +0 -17
  107. data/distro/debian/etc/init/chef-server-webui.conf +0 -17
  108. data/distro/debian/etc/init/chef-server.conf +0 -17
  109. data/distro/debian/etc/init/chef-solr.conf +0 -17
  110. data/distro/redhat/etc/init.d/chef-client +0 -121
  111. data/distro/redhat/etc/init.d/chef-expander +0 -104
  112. data/distro/redhat/etc/init.d/chef-server +0 -112
  113. data/distro/redhat/etc/init.d/chef-server-webui +0 -112
  114. data/distro/redhat/etc/init.d/chef-solr +0 -104
  115. data/distro/redhat/etc/logrotate.d/chef-client +0 -8
  116. data/distro/redhat/etc/logrotate.d/chef-expander +0 -8
  117. data/distro/redhat/etc/logrotate.d/chef-server +0 -8
  118. data/distro/redhat/etc/logrotate.d/chef-server-webui +0 -8
  119. data/distro/redhat/etc/logrotate.d/chef-solr +0 -8
  120. data/distro/redhat/etc/sysconfig/chef-client +0 -15
  121. data/distro/redhat/etc/sysconfig/chef-expander +0 -7
  122. data/distro/redhat/etc/sysconfig/chef-server +0 -14
  123. data/distro/redhat/etc/sysconfig/chef-server-webui +0 -14
  124. data/distro/redhat/etc/sysconfig/chef-solr +0 -8
  125. data/distro/windows/service_manager.rb +0 -164
@@ -1,176 +0,0 @@
1
- #! /bin/sh
2
- ### BEGIN INIT INFO
3
- # Provides: chef-expander
4
- # Required-Start: $remote_fs $network rabbitmq-server chef-solr
5
- # Required-Stop: $remote_fs $network rabbitmq-server chef-solr
6
- # Default-Start: 2 3 4 5
7
- # Default-Stop: 0 1 6
8
- # Short-Description: Start a chef-expander.
9
- ### END INIT INFO
10
- #
11
- # Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com>
12
- #
13
- # chef-expander Startup script for chef-expander.
14
- # chkconfig: - 85 02
15
- # description: starts up chef-expander in daemon mode.
16
-
17
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=$(which chef-expander)
19
- NAME=chef-expander
20
- DESC=chef-expander
21
- PIDFILE=/var/run/chef/expander.pid
22
-
23
- test -x $DAEMON || exit 0
24
-
25
- . /lib/lsb/init-functions
26
-
27
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
28
-
29
- if [ ! -d /var/run/chef ]; then
30
- mkdir /var/run/chef
31
- chown $USER:$GROUP /var/run/chef
32
- fi
33
-
34
- DAEMON_OPTS="-d -c $CONFIG -P $PIDFILE -L $LOGFILE $CHEF_EXPANDER_ARGS"
35
-
36
- running_pid() {
37
- pid=$1
38
- name=$2
39
- [ -z "$pid" ] && return 1
40
- [ ! -d /proc/$pid ] && return 1
41
- cmd=`cat /proc/$pid/cmdline | tr '\000' '\n' | awk 'NR==2'`
42
- [ "$cmd" != "$name" ] && return 1
43
- return 0
44
- }
45
-
46
- running() {
47
- [ ! -f "$PIDFILE" ] && return 1
48
- pid=`cat $PIDFILE`
49
- running_pid $pid $DAEMON || return 1
50
- return 0
51
- }
52
-
53
- start_server() {
54
- if [ -z "$DAEMONUSER" ] ; then
55
- start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
56
- errcode=$?
57
- else
58
- start-stop-daemon --start --quiet --pidfile $PIDFILE \
59
- --chuid $DAEMONUSER \
60
- --exec $DAEMON -- $DAEMON_OPTS
61
- errcode=$?
62
- fi
63
- return $errcode
64
- }
65
-
66
- stop_server() {
67
- if [ -z "$DAEMONUSER" ] ; then
68
- killproc -p $PIDFILE $DAEMON
69
- errcode=$?
70
- else
71
- start-stop-daemon --stop --quiet --pidfile $PIDFILE \
72
- --user $DAEMONUSER \
73
- --exec $DAEMON
74
- errcode=$?
75
- fi
76
- return $errcode
77
- }
78
-
79
- reload_server() {
80
- [ ! -f "$PIDFILE" ] && return 1
81
- pid=pidofproc $PIDFILE # This is the daemon's pid
82
- /bin/kill -1 $pid
83
- return $?
84
- }
85
-
86
- force_stop() {
87
- [ ! -e "$PIDFILE" ] && return
88
- if running ; then
89
- /bin/kill -15 $pid
90
- sleep "$DIETIME"s
91
- if running ; then
92
- /bin/kill -9 $pid
93
- sleep "$DIETIME"s
94
- if running ; then
95
- echo "Cannot kill $NAME (pid=$pid)!"
96
- exit 1
97
- fi
98
- fi
99
- fi
100
- rm -f $PIDFILE
101
- }
102
-
103
- case "$1" in
104
- start)
105
- log_daemon_msg "Starting $DESC " "$NAME"
106
- if running ; then
107
- log_progress_msg "apparently already running"
108
- log_end_msg 0
109
- exit 3
110
- fi
111
- if start_server ; then
112
- [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
113
- if running ; then
114
- log_end_msg 0
115
- else
116
- log_end_msg 1
117
- fi
118
- else
119
- log_end_msg 1
120
- fi
121
- ;;
122
- stop)
123
- log_daemon_msg "Stopping $DESC" "$NAME"
124
- if running ; then
125
- errcode=0
126
- stop_server || errcode=$?
127
- log_end_msg $errcode
128
- else
129
- log_progress_msg "apparently not running"
130
- log_end_msg 0
131
- exit 0
132
- fi
133
- ;;
134
- force-stop)
135
- $0 stop
136
- if running; then
137
- log_daemon_msg "Stopping (force) $DESC" "$NAME"
138
- errcode=0
139
- force_stop || errcode=$?
140
- log_end_msg $errcode
141
- fi
142
- ;;
143
- restart|force-reload)
144
- log_daemon_msg "Restarting $DESC" "$NAME"
145
- errcode=0
146
- stop_server || errcode=$?
147
- [ -n "$DIETIME" ] && sleep $DIETIME
148
- start_server || errcode=$?
149
- [ -n "$STARTTIME" ] && sleep $STARTTIME
150
- running || errcode=$?
151
- log_end_msg $errcode
152
- ;;
153
- status)
154
- log_daemon_msg "Checking status of $DESC" "$NAME"
155
- if running ; then
156
- log_progress_msg "running"
157
- log_end_msg 0
158
- else
159
- log_progress_msg "apparently not running"
160
- log_end_msg 1
161
- exit 1
162
- fi
163
- ;;
164
- reload)
165
- log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
166
- log_warning_msg "cannot re-read the config file (use restart)."
167
- ;;
168
- *)
169
- N=/etc/init.d/$NAME
170
- echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
171
- exit 1
172
- ;;
173
- esac
174
-
175
- exit 0
176
-
@@ -1,122 +0,0 @@
1
- #! /bin/sh
2
- ### BEGIN INIT INFO
3
- # Provides: chef-server
4
- # Required-Start: $remote_fs $network rabbitmq-server couchdb
5
- # Required-Stop: $remote_fs $network rabbitmq-server couchdb
6
- # Default-Start: 2 3 4 5
7
- # Default-Stop: 0 1 6
8
- # Short-Description: Start a chef-server.
9
- ### END INIT INFO
10
- #
11
- # Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com>
12
- #
13
- # chef-server Startup script for chef-server.
14
- # chkconfig: - 90 02
15
- # description: starts up chef-server webui.
16
-
17
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=$(which chef-server)
19
- PIDFILE=/var/run/chef/server.%s.pid
20
- MAINPID=/var/run/chef/server.main.pid
21
- NAME=chef-server
22
- DESC=chef-server
23
-
24
- test -x $DAEMON || exit 0
25
-
26
- . /lib/lsb/init-functions
27
-
28
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
29
-
30
- if [ ! -d /var/run/chef ]; then
31
- mkdir /var/run/chef
32
- chown $USER:$GROUP /var/run/chef
33
- fi
34
-
35
- DAEMON_OPTS="-p $PORT -e production -d -a $ADAPTER -P $PIDFILE -L $LOGFILE -C $CONFIG -u $USER -G $GROUP"
36
-
37
- running() {
38
- [ ! -f "$MAINPID" ] && return 1
39
- pid=`cat $MAINPID`
40
- [ -z "$pid" ] && return 1
41
- [ ! -d /proc/$pid ] && return 1
42
- (ps -fp $pid | egrep -q "merb.*(merb : master|worker.*$PORT)") || return 1
43
- return 0
44
- }
45
-
46
- start_server() {
47
- $DAEMON $DAEMON_OPTS
48
- errcode=$?
49
- return $errcode
50
- }
51
-
52
- stop_server() {
53
- $DAEMON -K all -P $PIDFILE
54
- errcode=$?
55
- return $errcode
56
- }
57
-
58
- reload_server() {
59
- stop_server
60
- [ -n "$DIETIME" ] && sleep $DIETIME
61
- start_server
62
- [ -n "$STARTTIME" ] && sleep $STARTTIME
63
- }
64
-
65
- case "$1" in
66
- start)
67
- log_daemon_msg "Starting $DESC "
68
- if running ; then
69
- log_progress_msg "apparently already running"
70
- log_end_msg 0
71
- exit 0
72
- fi
73
- if start_server ; then
74
- [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
75
- if running ; then
76
- log_end_msg 0
77
- else
78
- log_end_msg 1
79
- fi
80
- else
81
- log_end_msg 1
82
- fi
83
- ;;
84
- stop)
85
- log_daemon_msg "Stopping $DESC"
86
- if running ; then
87
- errcode=0
88
- stop_server || errcode=$?
89
- log_end_msg $errcode
90
- else
91
- log_progress_msg "apparently not running"
92
- log_end_msg 0
93
- exit 0
94
- fi
95
- ;;
96
- restart|force-reload)
97
- log_daemon_msg "Restarting $DESC"
98
- errcode=0
99
- reload_server
100
- running && errcode=$?
101
- log_end_msg $errcode
102
- ;;
103
- status)
104
- log_daemon_msg "Checking status of $DESC"
105
- if running ; then
106
- log_progress_msg "running"
107
- log_end_msg 0
108
- else
109
- log_progress_msg "apparently not running"
110
- log_end_msg 1
111
- exit 3
112
- fi
113
- ;;
114
- *)
115
- N=/etc/init.d/$NAME
116
- echo "Usage: $N {start|stop|restart|status}" >&2
117
- exit 1
118
- ;;
119
- esac
120
-
121
- exit 0
122
-
@@ -1,123 +0,0 @@
1
- #! /bin/sh
2
- ### BEGIN INIT INFO
3
- # Provides: chef-server-webui
4
- # Required-Start: $remote_fs $network chef-server
5
- # Required-Stop: $remote_fs $network chef-server
6
- # Default-Start: 2 3 4 5
7
- # Default-Stop: 0 1 6
8
- # Short-Description: Start a chef-server-webui
9
- ### END INIT INFO
10
- #
11
- # Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com>
12
- #
13
- # chef-server-webui Startup script for chef-server-webui.
14
- # chkconfig: - 95 02
15
- # description: starts up chef-server webui.
16
-
17
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=$(which chef-server-webui)
19
- PIDFILE=/var/run/chef/server-webui.%s.pid
20
- MAINPID=/var/run/chef/server-webui.main.pid
21
- NAME=chef-server-webui
22
- DESC=chef-server-webui
23
-
24
- test -x $DAEMON || exit 0
25
-
26
- . /lib/lsb/init-functions
27
-
28
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
29
-
30
- if [ ! -d /var/run/chef ]; then
31
- mkdir /var/run/chef
32
- chown $USER:$GROUP /var/run/chef
33
- fi
34
-
35
- DAEMON_OPTS="-p $PORT -e production -d -a $ADAPTER -P $PIDFILE -L $LOGFILE -C $CONFIG -u $USER -G $GROUP"
36
-
37
- running() {
38
- [ ! -f "$MAINPID" ] && return 1
39
- pid=`cat $MAINPID`
40
- name=$WORKER
41
- [ -z "$pid" ] && return 1
42
- [ ! -d /proc/$pid ] && return 1
43
- (ps -fp $pid | egrep -q "merb.*(merb : master|worker.*$PORT)") || return 1
44
- return 0
45
- }
46
-
47
- start_server() {
48
- $DAEMON $DAEMON_OPTS
49
- errcode=$?
50
- return $errcode
51
- }
52
-
53
- stop_server() {
54
- $DAEMON -K all -P $PIDFILE
55
- errcode=$?
56
- return $errcode
57
- }
58
-
59
- reload_server() {
60
- stop_server
61
- [ -n "$DIETIME" ] && sleep $DIETIME
62
- start_server
63
- [ -n "$STARTTIME" ] && sleep $STARTTIME
64
- }
65
-
66
- case "$1" in
67
- start)
68
- log_daemon_msg "Starting $DESC "
69
- if running ; then
70
- log_progress_msg "apparently already running"
71
- log_end_msg 0
72
- exit 0
73
- fi
74
- if start_server ; then
75
- [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
76
- if running ; then
77
- log_end_msg 0
78
- else
79
- log_end_msg 1
80
- fi
81
- else
82
- log_end_msg 1
83
- fi
84
- ;;
85
- stop)
86
- log_daemon_msg "Stopping $DESC"
87
- if running ; then
88
- errcode=0
89
- stop_server || errcode=$?
90
- log_end_msg $errcode
91
- else
92
- log_progress_msg "apparently not running"
93
- log_end_msg 0
94
- exit 0
95
- fi
96
- ;;
97
- restart|force-reload)
98
- log_daemon_msg "Restarting $DESC"
99
- errcode=0
100
- reload_server
101
- running && errcode=$?
102
- log_end_msg $errcode
103
- ;;
104
- status)
105
- log_daemon_msg "Checking status of $DESC"
106
- if running ; then
107
- log_progress_msg "running"
108
- log_end_msg 0
109
- else
110
- log_progress_msg "apparently not running"
111
- log_end_msg 1
112
- exit 3
113
- fi
114
- ;;
115
- *)
116
- N=/etc/init.d/$NAME
117
- echo "Usage: $N {start|stop|restart|status}" >&2
118
- exit 1
119
- ;;
120
- esac
121
-
122
- exit 0
123
-
@@ -1,176 +0,0 @@
1
- #! /bin/sh
2
- ### BEGIN INIT INFO
3
- # Provides: chef-solr
4
- # Required-Start: $remote_fs $network
5
- # Required-Stop: $remote_fs $network
6
- # Default-Start: 2 3 4 5
7
- # Default-Stop: 0 1 6
8
- # Short-Description: Start a chef-solr.
9
- ### END INIT INFO
10
- #
11
- # Copyright (c) 2009-2010 Opscode, Inc <legal@opscode.com>
12
- #
13
- # chef-solr Startup script for chef-solr.
14
- # chkconfig: - 84 02
15
- # description: starts up chef-solr in daemon mode.
16
-
17
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=$(which chef-solr)
19
- DAEMON_NAME=java
20
- NAME=chef-solr
21
- DESC=chef-solr
22
- PIDFILE=/var/run/chef/solr.pid
23
-
24
- test -x $DAEMON || exit 0
25
-
26
- . /lib/lsb/init-functions
27
-
28
- [ -r /etc/default/$NAME ] && . /etc/default/$NAME
29
-
30
- if [ ! -d /var/run/chef ]; then
31
- mkdir /var/run/chef
32
- chown $USER:$GROUP /var/run/chef
33
- fi
34
-
35
- if [ ! -f $LOGFILE ]; then
36
- touch $LOGFILE
37
- chown $USER:$GROUP $LOGFILE
38
- fi
39
-
40
- DAEMON_OPTS="-d -P $PIDFILE -c $CONFIG -L $LOGFILE -u $USER -g $GROUP"
41
-
42
- running_pid() {
43
- pid=$1
44
- name=$2
45
- [ -z "$pid" ] && return 1
46
- [ ! -d /proc/$pid ] && return 1
47
- cmd=`cat /proc/$pid/cmdline | tr '\000' '\n' | head -1`
48
- [ "$cmd" != "$name" ] && return 1
49
- return 0
50
- }
51
-
52
- running() {
53
- [ ! -f "$PIDFILE" ] && return 1
54
- pid=`cat $PIDFILE`
55
- running_pid $pid $DAEMON_NAME || return 1
56
- return 0
57
- }
58
-
59
- start_server() {
60
- start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
61
- errcode=$?
62
- for i in `seq 0 $MAXTRIES`
63
- do
64
- if running; then
65
- errcode=0
66
- break
67
- else
68
- [ -n "$STARTTIME" ] && sleep $STARTTIME
69
- fi
70
- done
71
- return $errcode
72
- }
73
-
74
- stop_server() {
75
- killproc -p $PIDFILE $DAEMON
76
- errcode=$?
77
- return $errcode
78
- }
79
-
80
- reload_server() {
81
- [ ! -f "$PIDFILE" ] && return 1
82
- pid=pidofproc $PIDFILE # This is the daemon's pid
83
- /bin/kill -1 $pid
84
- return $?
85
- }
86
-
87
- force_stop() {
88
- [ ! -e "$PIDFILE" ] && return
89
- if running ; then
90
- /bin/kill -15 $pid
91
- sleep "$DIETIME"s
92
- if running ; then
93
- /bin/kill -9 $pid
94
- sleep "$DIETIME"s
95
- if running ; then
96
- echo "Cannot kill $NAME (pid=$pid)!"
97
- exit 1
98
- fi
99
- fi
100
- fi
101
- rm -f $PIDFILE
102
- }
103
-
104
- case "$1" in
105
- start)
106
- log_daemon_msg "Starting $DESC " "$NAME"
107
- if running ; then
108
- log_progress_msg "apparently already running"
109
- log_end_msg 0
110
- exit 3
111
- fi
112
- if start_server ; then
113
- [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
114
- if running ; then
115
- log_end_msg 0
116
- else
117
- log_end_msg 1
118
- fi
119
- else
120
- log_end_msg 1
121
- fi
122
- ;;
123
- stop)
124
- log_daemon_msg "Stopping $DESC" "$NAME"
125
- if running ; then
126
- errcode=0
127
- stop_server || errcode=$?
128
- log_end_msg $errcode
129
- else
130
- log_progress_msg "apparently not running"
131
- log_end_msg 0
132
- exit 0
133
- fi
134
- ;;
135
- force-stop)
136
- $0 stop
137
- if running; then
138
- log_daemon_msg "Stopping (force) $DESC" "$NAME"
139
- errcode=0
140
- force_stop || errcode=$?
141
- log_end_msg $errcode
142
- fi
143
- ;;
144
- restart|force-reload)
145
- log_daemon_msg "Restarting $DESC" "$NAME"
146
- errcode=0
147
- stop_server || errcode=$?
148
- [ -n "$DIETIME" ] && sleep $DIETIME
149
- start_server || errcode=$?
150
- [ -n "$STARTTIME" ] && sleep $STARTTIME
151
- running || errcode=$?
152
- log_end_msg $errcode
153
- ;;
154
- status)
155
- log_daemon_msg "Checking status of $DESC" "$NAME"
156
- if running ; then
157
- log_progress_msg "running"
158
- log_end_msg 0
159
- else
160
- log_progress_msg "apparently not running"
161
- log_end_msg 1
162
- exit 1
163
- fi
164
- ;;
165
- reload)
166
- log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
167
- log_warning_msg "cannot re-read the config file (use restart)."
168
- ;;
169
- *)
170
- N=/etc/init.d/$NAME
171
- echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
172
- exit 1
173
- ;;
174
- esac
175
-
176
- exit 0