capigen 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. data/Capfile +22 -0
  2. data/History.txt +3 -0
  3. data/License.txt +20 -0
  4. data/Manifest.txt +83 -0
  5. data/README.txt +35 -0
  6. data/Rakefile +4 -0
  7. data/config/hoe.rb +70 -0
  8. data/config/requirements.rb +17 -0
  9. data/init.rb +3 -0
  10. data/lib/capigen/config.rb +84 -0
  11. data/lib/capigen/helper.rb +51 -0
  12. data/lib/capigen/helpers/gem_helper.rb +15 -0
  13. data/lib/capigen/helpers/package_helper.rb +40 -0
  14. data/lib/capigen/helpers/script_helper.rb +30 -0
  15. data/lib/capigen/helpers/wget_helper.rb +17 -0
  16. data/lib/capigen/packagers/yum.rb +46 -0
  17. data/lib/capigen/profiles.rb +19 -0
  18. data/lib/capigen/recipes.yml +14 -0
  19. data/lib/capigen/templates.rb +65 -0
  20. data/lib/capigen/version.rb +9 -0
  21. data/lib/capigen.rb +26 -0
  22. data/recipes/README +12 -0
  23. data/recipes/bootstrap/patch.rb +87 -0
  24. data/recipes/centos.rb +40 -0
  25. data/recipes/deploy.rb +17 -0
  26. data/recipes/gems.rb +8 -0
  27. data/recipes/imagemagick.rb +9 -0
  28. data/recipes/install.rb +13 -0
  29. data/recipes/memcached.rb +15 -0
  30. data/recipes/mongrel_cluster.rb +49 -0
  31. data/recipes/monit.rb +16 -0
  32. data/recipes/mysql.rb +24 -0
  33. data/recipes/nginx.rb +42 -0
  34. data/recipes/profiles/centos-sick.rb +65 -0
  35. data/recipes/rails.rb +14 -0
  36. data/recipes/ruby.rb +14 -0
  37. data/recipes/sphinx.rb +62 -0
  38. data/script/destroy +14 -0
  39. data/script/generate +14 -0
  40. data/script/txt2html +74 -0
  41. data/setup.rb +1585 -0
  42. data/tasks/capigen.rake +13 -0
  43. data/tasks/deployment.rake +34 -0
  44. data/tasks/environment.rake +7 -0
  45. data/tasks/website.rake +17 -0
  46. data/templates/capistrano/Capfile +22 -0
  47. data/templates/capistrano/deploy.rb.erb +61 -0
  48. data/templates/centos/setup.sh +17 -0
  49. data/templates/centos/sudoers +95 -0
  50. data/templates/imagemagick/install.sh +20 -0
  51. data/templates/memcached/install.sh +27 -0
  52. data/templates/memcached/memcached.initd.centos.erb +70 -0
  53. data/templates/memcached/memcached.monitrc.erb +4 -0
  54. data/templates/mongrel/mongrel_cluster.initd.erb +61 -0
  55. data/templates/mongrel/mongrel_cluster.monitrc.erb +15 -0
  56. data/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  57. data/templates/monit/cert.sh +14 -0
  58. data/templates/monit/install.sh +29 -0
  59. data/templates/monit/monit.cnf +34 -0
  60. data/templates/monit/monit.initd.centos.erb +68 -0
  61. data/templates/monit/monitrc.erb +28 -0
  62. data/templates/monit/patch_inittab.sh +15 -0
  63. data/templates/mysql/install.sh.erb +10 -0
  64. data/templates/mysql/install_db.sql.erb +5 -0
  65. data/templates/mysql/mysql.monitrc.erb +6 -0
  66. data/templates/nginx/install.sh.erb +42 -0
  67. data/templates/nginx/nginx.conf.erb +76 -0
  68. data/templates/nginx/nginx.initd.erb +62 -0
  69. data/templates/nginx/nginx.monitrc.erb +4 -0
  70. data/templates/nginx/nginx_vhost.conf.erb +94 -0
  71. data/templates/rails/database.yml.erb +42 -0
  72. data/templates/ruby/ruby_install.sh +26 -0
  73. data/templates/ruby/rubygems_install.sh +13 -0
  74. data/templates/sphinx/install.sh.erb +22 -0
  75. data/templates/sphinx/sphinx.conf.erb +496 -0
  76. data/templates/sphinx/sphinx.monitrc.erb +4 -0
  77. data/templates/sphinx/sphinx_app.initd.centos.erb +67 -0
  78. data/templates/sphinx/sphinx_app.initd.erb +57 -0
  79. data/website/index.html +93 -0
  80. data/website/index.txt +39 -0
  81. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  82. data/website/stylesheets/screen.css +138 -0
  83. data/website/template.rhtml +48 -0
  84. metadata +141 -0
@@ -0,0 +1,496 @@
1
+ #
2
+ # Sphinx configuration file sample
3
+ #
4
+
5
+ #############################################################################
6
+ ## data source definition
7
+ #############################################################################
8
+
9
+ source <%= application %>
10
+ {
11
+ # data source type
12
+ # for now, known types are 'mysql', 'pgsql' and 'xmlpipe'
13
+ # MUST be defined
14
+ type = mysql
15
+
16
+ # whether to strip HTML
17
+ # values can be 0 (don't strip) or 1 (do strip)
18
+ # WARNING, only works with mysql source for now
19
+ # WARNING, should work ok for PERFECTLY formed XHTML for now
20
+ # WARNING, POSSIBLE TO BUG on malformed everday HTML
21
+ # optional, default is 0
22
+ strip_html = 0
23
+
24
+ # what HTML attributes to index if stripping HTML
25
+ # format is as follows:
26
+ #
27
+ # index_html_attrs = img=alt,title; a=title;
28
+ #
29
+ # optional, default is to not index anything
30
+ index_html_attrs =
31
+
32
+ #####################################################################
33
+
34
+ # some straightforward parameters for 'mysql' source type
35
+ sql_host = 127.0.0.1
36
+ sql_user = <%= db_user %>
37
+ sql_pass = <%= db_pass %>
38
+ sql_db = <%= db_name %>
39
+ sql_port = 3306 # optional, default is 3306
40
+
41
+ # sql_sock = /tmp/mysql.sock
42
+ #
43
+ # optional
44
+ # usually '/var/lib/mysql/mysql.sock' on Linux
45
+ # usually '/tmp/mysql.sock' on FreeBSD
46
+
47
+ # pre-query, executed before the main fetch query
48
+ # useful eg. to setup encoding or mark records
49
+ # optional, default is empty
50
+ #
51
+ # sql_query_pre = SET CHARACTER_SET_RESULTS=cp1251
52
+ sql_query_pre = SET NAMES UTF8
53
+
54
+ # main document fetch query
55
+ #
56
+ # you can specify up to 32 (formally SPH_MAX_FIELDS in sphinx.h) fields;
57
+ # all of the fields which are not document_id or attributes (see below)
58
+ # will be full-text indexed
59
+ #
60
+ # document_id MUST be the very first field
61
+ # document_id MUST be positive (non-zero, non-negative)
62
+ # document_id MUST fit into 32 bits
63
+ # document_id MUST be unique
64
+ #
65
+ # mandatory
66
+ sql_query = \
67
+ SELECT id, UNIX_TIMESTAMP(created_at) AS created_at, body FROM todo
68
+
69
+ # query range setup
70
+ #
71
+ # useful to avoid MyISAM table locks and big result sets
72
+ # when indexing lots of data
73
+ #
74
+ # to use query ranges, you should
75
+ # 1) provide a query to fetch min/max id (ie. id range) from data set;
76
+ # 2) configure step size in which this range will be walked;
77
+ # 3) use $start and $end macros somewhere in the main fetch query.
78
+ #
79
+ # 'sql_query_range' must return exactly two integer fields
80
+ # in exactly min_id, max_id order
81
+ #
82
+ # 'sql_range_step' must be a positive integer
83
+ # optional, default is 1024
84
+ #
85
+ # 'sql_query' must contain both '$start' and '$end' macros
86
+ # if you are using query ranges (because it obviously would be an
87
+ # error to index the whole table many times)
88
+ #
89
+ # note that the intervals specified by $start/$end do not
90
+ # overlap, so you should NOT remove document ids which are exactly
91
+ # equal to $start or $end in your query
92
+ #
93
+ # here's an example which will index 'documents' table
94
+ # fetching (at most) one thousand entries at a time:
95
+ #
96
+ # sql_query_range = SELECT MIN(id),MAX(id) FROM documents
97
+ # sql_range_step = 1000
98
+ # sql_query = \
99
+ # SELECT doc.id, doc.id AS group, doc.title, doc.data \
100
+ # FROM documents doc \
101
+ # WHERE id>=$start AND id<=$end
102
+
103
+
104
+ # attribute columns
105
+ #
106
+ # attribute values MUST be positive (non-zero, non-negative) integers
107
+ # attribute values MUST fit into 32 bits
108
+ #
109
+ # attributes are additional values associated with each document which
110
+ # may be used to perform additional filtering and sorting during search.
111
+ # attributes are NOT full-text indexed; they are stored in the full text
112
+ # index as is.
113
+ #
114
+ # a good example would be a forum posts table. one might need to search
115
+ # through 'title' and 'content' fields but to limit search to specific
116
+ # values of 'author_id', or 'forum_id', or to sort by 'post_date', or to
117
+ # group matches by 'thread_id', or to group posts by month of the
118
+ # 'post_date' and provide statistics.
119
+ #
120
+ # this all can be achieved by specifying all the mentioned columns
121
+ # (excluding 'title' and 'content' which are full-text fields) as
122
+ # attributes and then using API calls to setup filtering, sorting,
123
+ # and grouping.
124
+ #
125
+ # sql_group_column is used to declare integer attributes.
126
+ #
127
+ # sql_date_column is used to declare UNIX timestamp attributes.
128
+ #
129
+ # sql_str2ordinal_column is used to declare integer attributes which
130
+ # values are computed as ordinal numbers of corresponding column value
131
+ # in sorted list of column values. WARNING, all such strings values
132
+ # are going to be stored in RAM while indexing, and "C" locale will
133
+ # be used when sorting!
134
+ #
135
+ # starting with 0.9.7, there may be multiple attribute columns specified.
136
+ # here's an example for that mentioned posts table:
137
+ #
138
+ # sql_group_column = author_id
139
+ # sql_group_column = forum_id
140
+ # sql_group_column = thread_id
141
+ # sql_date_column = post_unix_timestamp
142
+ # sql_date_column = last_edit_unix_timestamp
143
+ #
144
+ # optional, default is empty
145
+ ##sql_group_column = group_id
146
+ sql_date_column = created_at
147
+ # sql_str2ordinal_column = author_name
148
+
149
+ # post-query, executed on the end of main fetch query
150
+ #
151
+ # note that indexing is NOT completed at the point when post-query
152
+ # gets executed and might very well fail
153
+ #
154
+ # optional, default is empty
155
+ ##sql_query_post =
156
+
157
+ # post-index-query, executed on succsefully completed indexing
158
+ #
159
+ # $maxid macro is the max document ID which was actually
160
+ # fetched from the database
161
+ #
162
+ # optional, default is empty
163
+ #
164
+ # sql_query_post_index = REPLACE INTO counters ( id, val ) \
165
+ # VALUES ( 'max_indexed_id', $maxid )
166
+
167
+
168
+ # document info query
169
+ #
170
+ # ONLY used by search utility to display document information
171
+ # MUST be able to fetch document info by its id, therefore
172
+ # MUST contain '$id' macro
173
+ #
174
+ # optional, default is empty
175
+ ##sql_query_info = SELECT * FROM documents WHERE id=$id
176
+
177
+ #####################################################################
178
+
179
+ # demo config for 'xmlpipe' source type is a little below
180
+ #
181
+ # with xmlpipe, indexer opens a pipe to a given command,
182
+ # and then reads documents from stdin
183
+ #
184
+ # indexer expects one or more documents from xmlpipe stdin
185
+ # each document must be formatted exactly as follows:
186
+ #
187
+ # <document>
188
+ # <id>123</id>
189
+ # <group>45</group>
190
+ # <timestamp>1132223498</timestamp>
191
+ # <title>test title</title>
192
+ # <body>
193
+ # this is my document body
194
+ # </body>
195
+ # </document>
196
+ #
197
+ # timestamp element is optional, its default value is 1
198
+ # all the other elements are mandatory
199
+
200
+ # type = xmlpipe
201
+ # xmlpipe_command = cat /var/test.xml
202
+ }
203
+
204
+
205
+ # inherited source example
206
+ #
207
+ # all the parameters are copied from the parent source,
208
+ # and may then be overridden in this source definition
209
+ ##source src1stripped : src1
210
+ ##{
211
+ ## strip_html = 1
212
+ ##}
213
+
214
+ #############################################################################
215
+ ## index definition
216
+ #############################################################################
217
+
218
+ # local index example
219
+ #
220
+ # this is an index which is stored locally in the filesystem
221
+ #
222
+ # all indexing-time options (such as morphology and charsets)
223
+ # are configured per local index
224
+ index <%= application %>
225
+ {
226
+ # which document source to index
227
+ # at least one MUST be defined
228
+ #
229
+ # multiple sources MAY be specified; to do so, just add more
230
+ # "source = NAME" lines. in this case, ALL the document IDs
231
+ # in ALL the specified sources MUST be unique
232
+ source = <%= application %>
233
+
234
+ # this is path and index file name without extension
235
+ #
236
+ # indexer will append different extensions to this path to
237
+ # generate names for both permanent and temporary index files
238
+ #
239
+ # .tmp* files are temporary and can be safely removed
240
+ # if indexer fails to remove them automatically
241
+ #
242
+ # .sp* files are fulltext index data files. specifically,
243
+ # .spa contains attribute values attached to each document id
244
+ # .spd contains doclists and hitlists
245
+ # .sph contains index header (schema and other settings)
246
+ # .spi contains wordlists
247
+ #
248
+ # MUST be defined
249
+ path = /var/sphinx/<%= application %>
250
+
251
+ # docinfo (ie. per-document attribute values) storage strategy
252
+ # defines how docinfo will be stored
253
+ #
254
+ # available values are "none", "inline" and "extern"
255
+ #
256
+ # "none" means there'll be no docinfo at all (no groups/dates)
257
+ #
258
+ # "inline" means that the docinfo will be stored in the .spd
259
+ # file along with the document ID lists (doclists)
260
+ #
261
+ # "extern" means that the docinfo will be stored in the .spa
262
+ # file separately
263
+ #
264
+ # externally stored docinfo should (basically) be kept in RAM
265
+ # when querying; therefore, "inline" may be the only viable option
266
+ # for really huge (50-100+ million docs) datasets. however, for
267
+ # smaller datasets "extern" storage makes both indexing and
268
+ # searching MUCH more efficient.
269
+ #
270
+ # additional search-time memory requirements for extern storage are
271
+ #
272
+ # ( 1 + number_of_attrs )*number_of_docs*4 bytes
273
+ #
274
+ # so 10 million docs with 2 groups and 1 timestamp will take
275
+ # (1+2+1)*10M*4 = 160 MB of RAM. this is PER DAEMON, ie. searchd
276
+ # will alloc 160 MB on startup, read the data and keep it shared
277
+ # between queries; the children will NOT allocate additional
278
+ # copies of this data.
279
+ #
280
+ # default is "extern" (as most collections are smaller than 100M docs)
281
+ docinfo = extern
282
+
283
+ # morphology
284
+ #
285
+ # currently supported morphology preprocessors are Porter stemmers
286
+ # for English and Russian, and Soundex. more stemmers could be added
287
+ # at users request.
288
+ #
289
+ # available values are "none", "stem_en", "stem_ru", "stem_enru",
290
+ # and "soundex"
291
+ #
292
+ # optional, default is "none"
293
+ #
294
+ # morphology = none
295
+ # morphology = stem_en
296
+ # morphology = stem_ru
297
+ # morphology = stem_enru
298
+ # morphology = soundex
299
+ morphology = none
300
+
301
+ # stopwords file
302
+ #
303
+ # format is plain text in whatever encoding you use
304
+ # optional, default is empty
305
+ #
306
+ # stopwords = /var/data/stopwords.txt
307
+ #stopwords =
308
+
309
+ # minimum word length
310
+ #
311
+ # only the words that are of this length and above will be indexed;
312
+ # for example, if min_word_len is 4, "the" won't be indexed,
313
+ # but "they" will be.
314
+ #
315
+ # default is 1, which (obviously) means to index everything
316
+ min_word_len = 1
317
+
318
+ # charset encoding type
319
+ #
320
+ # known types are 'sbcs' (Single Byte CharSet) and 'utf-8'
321
+ #
322
+ # optional, default is sbcs
323
+ charset_type = utf-8
324
+
325
+ # charset definition and case folding rules "table"
326
+ #
327
+ # optional, default value depends on charset_type
328
+ #
329
+ # for now, defaults are configured to support English and Russian
330
+ # this behavior MAY change in future versions
331
+ #
332
+ # 'sbcs' default value is
333
+ # charset_table = 0..9, A..Z->a..z, _, a..z, U+A8->U+B8, U+B8, U+C0..U+DF->U+E0..U+FF, U+E0..U+FF
334
+ #
335
+ # 'utf-8' default value is
336
+ # charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
337
+
338
+ # minimum prefix length
339
+ #
340
+ # if prefix length is positive, indexer will not only index all words,
341
+ # but all the possible prefixes (ie. word beginnings) as well
342
+ #
343
+ # for instance, "exam" query against such index will match documents
344
+ # which contain "example" word, even if they do not contain "exam"
345
+ #
346
+ # indexing prefixes will make the index grow significantly
347
+ # and could degrade search times
348
+ #
349
+ # currently there's no way to rank perfect word matches higher
350
+ # than prefix matches using only one index; you could setup two
351
+ # indexes for that
352
+ #
353
+ # default is 0, which means NOT to index prefixes
354
+ min_prefix_len = 0
355
+
356
+ # minimum infix length
357
+ #
358
+ # if infix length is positive, indexer will not only index all words,
359
+ # but all the possible infixes (ie. characters subsequences starting
360
+ # anywhere inside the word) as well
361
+ #
362
+ # for instance, "amp" query against such index will match documents
363
+ # which contain "example" word, even if they do not contain "amp"
364
+ #
365
+ # indexing prefixes will make the index grow significantly
366
+ # and could degrade search times
367
+ #
368
+ # currently there's no way to rank perfect word matches higher
369
+ # than infix matches using only one index; you could setup two
370
+ # indexes for that
371
+ #
372
+ # default is 0, which means NOT to index infixes
373
+ min_infix_len = 0
374
+
375
+ # n-grams length
376
+ #
377
+ # n-grams provide basic CJK support for unsegmented texts. if using
378
+ # n-grams, streams of CJK characters are indexed as n-grams. for example,
379
+ # if incoming stream is ABCDEF and n is 2, this text would be indexed
380
+ # as if it was AB BC CD DE EF.
381
+ #
382
+ # this feature is in alpha version state and only n=1 is currently
383
+ # supported; this is going to be improved.
384
+ #
385
+ # note that if search query is segmented (ie. words are separated with
386
+ # whitespace), words are in quotes and extended matching mode is used,
387
+ # then all matching documents will be returned even if their text was
388
+ # *not* segmented. in the example above, ABCDEF text will be indexed as
389
+ # A B C D E F, and "BCD" query will be transformed to "B C D" (where
390
+ # quotes is phrase matching operator), so the document will match.
391
+ #
392
+ # optional, default is 0, which means NOT to use n-grams
393
+ #
394
+ # ngram_len = 1
395
+
396
+ # n-gram characters table
397
+ #
398
+ # specifies what specific characters are subject to n-gram
399
+ # extraction. format is similar to charset_table.
400
+ #
401
+ # optional, default is empty
402
+ #
403
+ # ngrams_chars = U+3000..U+2FA1F
404
+ }
405
+
406
+
407
+ # inherited index example
408
+ #
409
+ # all the parameters are copied from the parent index,
410
+ # and may then be overridden in this index definition
411
+ ##index test1stemmed : test1
412
+ ##{
413
+ ## path = /var/data/test1stemmed
414
+ ## morphology = stem_en
415
+ ##}
416
+
417
+
418
+ #############################################################################
419
+ ## indexer settings
420
+ #############################################################################
421
+
422
+ indexer
423
+ {
424
+ # memory limit
425
+ #
426
+ # may be specified in bytes (no postfix), kilobytes (mem_limit=1000K)
427
+ # or megabytes (mem_limit=10M)
428
+ #
429
+ # will grow if set unacceptably low
430
+ # will warn if set too low and potentially hurting the performance
431
+ #
432
+ # optional, default is 32M
433
+ mem_limit = 32M
434
+ }
435
+
436
+ #############################################################################
437
+ ## searchd settings
438
+ #############################################################################
439
+
440
+ searchd
441
+ {
442
+ # IP address on which search daemon will bind and accept
443
+ # incoming network requests
444
+ #
445
+ # optional, default is to listen on all addresses,
446
+ # ie. address = 0.0.0.0
447
+ #
448
+ address = 127.0.0.1
449
+ # address = 192.168.0.1
450
+
451
+
452
+ # port on which search daemon will listen
453
+ port = 3312
454
+
455
+
456
+ # log file
457
+ # searchd run info is logged here
458
+ log = /var/sphinx/searchd.log
459
+
460
+
461
+ # query log file
462
+ # all the search queries are logged here
463
+ query_log = /var/sphinx/query.log
464
+
465
+
466
+ # client read timeout, seconds
467
+ read_timeout = 5
468
+
469
+
470
+ # maximum amount of children to fork
471
+ # useful to control server load
472
+ max_children = 30
473
+
474
+
475
+ # a file which will contain searchd process ID
476
+ # used for different external automation scripts
477
+ # MUST be present
478
+ pid_file = /var/sphinx/searchd.pid
479
+
480
+
481
+ # maximum amount of matches this daemon would ever retrieve
482
+ # from each index and serve to client
483
+ #
484
+ # this parameter affects per-client memory and CPU usage
485
+ # (16+ bytes per match) in match sorting phase; so blindly raising
486
+ # it to 1 million is definitely NOT recommended
487
+ #
488
+ # starting from 0.9.7, it can be decreased on the fly through
489
+ # the corresponding API call; increasing is prohibited to protect
490
+ # against malicious and/or malformed requests
491
+ #
492
+ # default is 1000 (just like with Google)
493
+ max_matches = 1000
494
+ }
495
+
496
+ # --eof--
@@ -0,0 +1,4 @@
1
+ check process sphinx_<%= application %> with pidfile <%= sphinx_pid_path %>
2
+ group search
3
+ start program = "/sbin/service sphinx_<%= application %> start"
4
+ stop program = "/sbin/service sphinx_<%= application %> stop"
@@ -0,0 +1,67 @@
1
+ #! /bin/sh
2
+ # sphinx: Sphinx search daemon for <%= application %>
3
+ #
4
+ # chkconfig: - 86 14
5
+ # description: sphinx search daemon
6
+ # processname: searchd
7
+ #
8
+ # Author: Gabriel Handford http://ducktyper.com
9
+
10
+ # Source function library
11
+ . /etc/rc.d/init.d/functions
12
+
13
+ RETVAL=0
14
+
15
+ DESC="sphinx daemon (<%= application %>)"
16
+ NAME=searchd
17
+ DAEMON=<%= sphinx_bin_path %>/searchd
18
+ CONFIGFILE=<%= sphinx_conf_path %>
19
+ PIDFILE=<%= sphinx_pid_path %>
20
+
21
+ start() {
22
+ daemon --user <%= user %> $DAEMON --config $CONFIGFILE
23
+ RETVAL=$?
24
+ echo
25
+ return $RETVAL;
26
+ }
27
+
28
+ stop() {
29
+ kill -QUIT `cat $PIDFILE` || echo -n " not running"
30
+ }
31
+
32
+ reload() {
33
+ kill -HUP `cat $PIDFILE` || echo -n " can't reload"
34
+ }
35
+
36
+ case "$1" in
37
+ start)
38
+ echo -n "Starting $DESC: $NAME"
39
+ start
40
+ RETVAL=$?;
41
+ ;;
42
+ stop)
43
+ echo -n "Stopping $DESC: $NAME"
44
+ stop
45
+ RETVAL=$?;
46
+ ;;
47
+ reload)
48
+ echo -n "Reloading $DESC configuration..."
49
+ reload
50
+ RETVAL=$?;
51
+ echo "reloaded."
52
+ ;;
53
+ restart)
54
+ echo -n "Restarting $DESC: $NAME"
55
+ stop
56
+ # Sleep after stop
57
+ sleep 1
58
+ start
59
+ RETVAL=$?;
60
+ ;;
61
+ *)
62
+ echo "Usage: $0 {start|stop|restart|force-reload}" >&2
63
+ RETVAL=3;
64
+ ;;
65
+ esac
66
+
67
+ exit $RETVAL;
@@ -0,0 +1,57 @@
1
+ #! /bin/sh
2
+ # sphinx Startup script for sphinx
3
+ #
4
+ # chkconfig: - 86 14
5
+ # description: sphinx search daemon
6
+ #
7
+ # Author: Gabriel Handford http://ducktyper.com
8
+
9
+ set -e
10
+
11
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
12
+ DESC="sphinx daemon"
13
+ NAME=searchd
14
+ DAEMON=<%= sphinx_bin_path %>/searchd
15
+ CONFIGFILE=<%= sphinx_conf_path %>
16
+ PIDFILE=<%= sphinx_pid_path %>
17
+
18
+ start() {
19
+ $DAEMON --config $CONFIGFILE || echo -n " already running"
20
+ }
21
+
22
+ stop() {
23
+ kill -QUIT `cat $PIDFILE` || echo -n " not running"
24
+ }
25
+
26
+ reload() {
27
+ kill -HUP `cat $PIDFILE` || echo -n " can't reload"
28
+ }
29
+
30
+ case "$1" in
31
+ start)
32
+ echo -n "Starting $DESC: $NAME"
33
+ start
34
+ ;;
35
+ stop)
36
+ echo -n "Stopping $DESC: $NAME"
37
+ stop
38
+ ;;
39
+ reload)
40
+ echo -n "Reloading $DESC configuration..."
41
+ reload
42
+ echo "reloaded."
43
+ ;;
44
+ restart)
45
+ echo -n "Restarting $DESC: $NAME"
46
+ stop
47
+ # Sleep
48
+ sleep 1
49
+ start
50
+ ;;
51
+ *)
52
+ echo "Usage: $0 {start|stop|restart|reload}" >&2
53
+ exit 3
54
+ ;;
55
+ esac
56
+
57
+ exit 0