le1t0-deprec 2.1.6.068 → 2.1.6.069
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,52 @@
|
|
1
|
-
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
1
|
+
# Copyright 2006-2008 by Mike Bailey, 2011 by le1t0. All rights reserved.
|
2
2
|
Capistrano::Configuration.instance(:must_exist).load do
|
3
3
|
namespace :deprec do
|
4
4
|
namespace :memcache do
|
5
5
|
|
6
|
-
set :memcache_ip, 'INDRR_ANY'
|
7
|
-
set :memcache_port, 11211
|
8
|
-
set
|
9
|
-
set :
|
10
|
-
set :
|
11
|
-
set :
|
6
|
+
set :memcache_ip, nil # -l ... -- memcached default is 'INDRR_ANY'
|
7
|
+
set :memcache_port, nil # -p ... -- memcached default is '11211'
|
8
|
+
set(:memcache_udp_port) { memcache_port } # -U ... -- defaults to memcache_port -- memcached default is '11211'
|
9
|
+
set :memcache_memory, nil # -m ... -- memcached default is '64'
|
10
|
+
set :memcache_factor, nil # -f ... -- memcached default is '1.25'
|
11
|
+
set :memcache_minsize, nil # -n ... -- memcached default is '48'
|
12
|
+
set :memcache_conn, nil # -c ... -- memcached default is '1024'
|
13
|
+
set :memcache_run_as, nil # -u ...
|
14
|
+
set :memcache_key_id_delim, nil # -D ... -- memcached default is ':'
|
15
|
+
set :memcache_threads, nil # -t ... -- memcached default is '4'
|
16
|
+
set :memcache_reqs_per_event, nil # -R ... -- memcached default is '20'
|
17
|
+
set :memcache_backlog_queue_limit, nil # -b ... -- memcached default is '1024'
|
18
|
+
set :memcache_binding_protocol, nil # -B auto|binary|ascii -- memcached default is 'auto'
|
19
|
+
set :memcache_slab_page_size, nil # -I [1k..128m] -- memcached default is '1m'
|
20
|
+
set :memcache_max_core_file_limit, false # -r -- memcached default is <not enabled>
|
21
|
+
set :memcache_error_on_mem_exhausted, false # -M -- memcached default is <not enabled>
|
22
|
+
set :memcache_lock_down_paged_mem, false # -k -- memcached default is <not enabled>
|
23
|
+
set :memcache_large_memory_pages, false # -L -- memcached default is <not enabled>
|
24
|
+
set :memcache_no_cas, false # -C -- memcached default is to use CAS
|
25
|
+
|
26
|
+
MEMCACHED_BOOLEAN_OPTIONS = {
|
27
|
+
:memcache_no_cas => :C
|
28
|
+
:memcache_large_memory_pages => :L,
|
29
|
+
:memcache_lock_down_paged_mem => :k,
|
30
|
+
:memcache_error_on_mem_exhausted => :M,
|
31
|
+
:memcache_max_core_file_limit => :r
|
32
|
+
}
|
33
|
+
|
34
|
+
MEMCACHED_VALUE_OPTIONS = {
|
35
|
+
:memcache_ip => :l,
|
36
|
+
:memcache_port => :p,
|
37
|
+
:memcache_udp_port => :U,
|
38
|
+
:memcache_memory => :m,
|
39
|
+
:memcache_factor => :f,
|
40
|
+
:memcache_minsize => :n,
|
41
|
+
:memcache_conn => :c,
|
42
|
+
:memcache_run_as => :u,
|
43
|
+
:memcache_key_id_delim => :D,
|
44
|
+
:memcache_threads => :t,
|
45
|
+
:memcache_reqs_per_event => :R,
|
46
|
+
:memcache_backlog_queue_limit => :b,
|
47
|
+
:memcache_binding_protocol => :B,
|
48
|
+
:memcache_slab_page_size => :I
|
49
|
+
}
|
12
50
|
|
13
51
|
SYSTEM_CONFIG_FILES[:memcache] = [
|
14
52
|
|
@@ -1,36 +1,61 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
|
3
|
+
<%
|
4
|
+
|
5
|
+
boolean_arguments = MEMCACHED_BOOLEAN_OPTIONS.collect do |name, opt|
|
6
|
+
if fetch(name)
|
7
|
+
"-#{opt}"
|
8
|
+
end
|
9
|
+
end.compact.join(' ')
|
10
|
+
|
11
|
+
value_arguments = MEMCACHED_VALUE_OPTIONS.collect do |name, opt|
|
12
|
+
if (value=fetch(name))
|
13
|
+
"-#{opt} #{value}"
|
14
|
+
end
|
15
|
+
end.compact.join(' ')
|
16
|
+
|
17
|
+
arguments = [ [ "-d", "-P $PIDFILE" ], boolean_arguments, value_arguments ].flatten.join(' ')
|
18
|
+
|
19
|
+
%>PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
4
20
|
DAEMON=/usr/local/bin/memcached
|
5
|
-
DAEMONBOOTSTRAP=/usr/local/share/memcached/scripts/start-memcached
|
6
21
|
NAME=memcached
|
7
22
|
DESC=memcached
|
8
23
|
PIDFILE=/var/run/$NAME.pid
|
9
24
|
|
10
25
|
test -x $DAEMON || exit 0
|
11
|
-
test -x $DAEMONBOOTSTRAP || exit 0
|
12
26
|
|
13
27
|
set -e
|
14
28
|
|
29
|
+
start () {
|
30
|
+
start-stop-daemon --start --quiet --exec $DAEMON -- <%= arguments %>
|
31
|
+
}
|
32
|
+
|
33
|
+
stop () {
|
34
|
+
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
|
35
|
+
rm -f $PIDFILE
|
36
|
+
}
|
37
|
+
|
38
|
+
restart () {
|
39
|
+
stop
|
40
|
+
sleep 1
|
41
|
+
start
|
42
|
+
}
|
43
|
+
|
15
44
|
case "$1" in
|
16
45
|
start)
|
17
46
|
echo -n "Starting $DESC: "
|
18
|
-
|
47
|
+
start
|
19
48
|
echo "$NAME."
|
20
49
|
;;
|
21
50
|
stop)
|
22
51
|
echo -n "Stopping $DESC: "
|
23
|
-
|
52
|
+
stop
|
24
53
|
echo "$NAME."
|
25
|
-
rm -f $PIDFILE
|
26
54
|
;;
|
27
55
|
|
28
56
|
restart|force-reload)
|
29
57
|
echo -n "Restarting $DESC: "
|
30
|
-
|
31
|
-
rm -f $PIDFILE
|
32
|
-
sleep 1
|
33
|
-
start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
|
58
|
+
restart
|
34
59
|
echo "$NAME."
|
35
60
|
;;
|
36
61
|
*)
|