1 |
06.06.2013 21:23, Андрей Буров пишет: |
2 |
> Для первого у Вас должно быть |
3 |
> start-stop-daemon --stop --pidfile /run/searchd-first.pid |
4 |
> для второго: |
5 |
> start-stop-daemon --stop --pidfile /run/searchd-second.pid |
6 |
> |
7 |
> start-stop-daemon --stop --exec /usr/bin/searchd и должен убивать |
8 |
> Все searchd |
9 |
> |
10 |
> |
11 |
> 2013/6/6 Sergey Kobzar <sergey.kobzar@××××.ru |
12 |
> <mailto:sergey.kobzar@××××.ru>> |
13 |
> |
14 |
> On 06/06/13 10:02, Андрей Буров wrote: |
15 |
> |
16 |
> Доброго времени суток |
17 |
> Поменяйте в скриптах: |
18 |
> start: |
19 |
> start-stop-daemon --start --make-pidfile --pidfile |
20 |
> /var/run/sphinx-test.pid --exec /usr/bin/searchd -- --config |
21 |
> /etc/sphinx/sphinx-test.conf |
22 |
> |
23 |
> stop: |
24 |
> start-stop-daemon --stop --pidfile /var/run/sphinx-test.pid |
25 |
> |
26 |
> |
27 |
> Сделал. Все-равно /etc/init.d/searchd stop останавливает 2 процесса. |
28 |
> |
29 |
> После старта (запускаются демоны разными скриптами): |
30 |
> 21467 ? S 0:00 /usr/bin/searchd |
31 |
> 21468 ? Sl 0:00 /usr/bin/searchd |
32 |
> 21485 ? S 0:00 /usr/bin/searchd --config |
33 |
> /etc/sphinx/sphinx-test.conf |
34 |
> 21486 ? Sl 0:18 /usr/bin/searchd --config |
35 |
> /etc/sphinx/sphinx-test.conf |
36 |
> |
37 |
> |
38 |
> Оригинальный скрипт /etc/init.d/searchd: |
39 |
> #!/sbin/runscript |
40 |
> # Copyright 1999-2004 Gentoo Foundation |
41 |
> # Distributed under the terms of the GNU General Public License v2 |
42 |
> # $Header: |
43 |
> /var/cvsroot/gentoo-x86/app-__misc/sphinx/files/searchd.rc,v 1.1 |
44 |
> 2009/11/05 15:41:56 graaff Exp $ |
45 |
> |
46 |
> |
47 |
> depend() { |
48 |
> need net |
49 |
> use logger |
50 |
> } |
51 |
> |
52 |
> checkconfig() { |
53 |
> if [ ! -f /etc/sphinx/sphinx.conf ] ; then |
54 |
> eerror "Please create /etc/sphinx/sphinx.conf" |
55 |
> |
56 |
> eerror "Sample conf: /etc/sphinx/sphinx.conf.dist" |
57 |
> return 1 |
58 |
> fi |
59 |
> return 0 |
60 |
> } |
61 |
> |
62 |
> start() { |
63 |
> checkconfig || return $? |
64 |
> |
65 |
> ebegin "Starting sphinx searchd" |
66 |
> start-stop-daemon --start --exec /usr/bin/searchd |
67 |
> eend $? "Failed to start sphinx searchd" |
68 |
> } |
69 |
> |
70 |
> stop() { |
71 |
> ebegin "Stopping sphinx searchd" |
72 |
> start-stop-daemon --stop --exec /usr/bin/searchd |
73 |
> eend $? "Failed to stop sphinx searchd" |
74 |
> } |
75 |
> |
76 |
> Скрипт для второго инстанса /etc/init.d/searchd-test: |
77 |
> #!/sbin/runscript |
78 |
> |
79 |
> |
80 |
> |
81 |
> depend() { |
82 |
> need net |
83 |
> use logger |
84 |
> } |
85 |
> |
86 |
> checkconfig() { |
87 |
> if [ ! -f /etc/sphinx/sphinx-test.conf ]; then |
88 |
> eerror "Please create /etc/sphinx/sphinx-test.conf" |
89 |
> eerror "Sample conf: /etc/sphinx/sphinx.conf.dist" |
90 |
> return 1 |
91 |
> fi |
92 |
> return 0 |
93 |
> } |
94 |
> |
95 |
> start() { |
96 |
> checkconfig || return $? |
97 |
> |
98 |
> ebegin "Starting sphinx searchd" |
99 |
> start-stop-daemon --start --make-pidfile --pidfile |
100 |
> /run/searchd-test.pid --exec /usr/bin/searchd -- --config |
101 |
> /etc/sphinx/sphinx-test.conf |
102 |
> |
103 |
> eend $? "Failed to start sphinx searchd" |
104 |
> } |
105 |
> |
106 |
> stop() { |
107 |
> ebegin "Stopping sphinx searchd" |
108 |
> start-stop-daemon --stop --pidfile /run/searchd-test.pid |
109 |
> |
110 |
> eend $? "Failed to stop sphinx searchd" |
111 |
> } |
112 |
> |
113 |
> |
114 |
> Может первому первому скрпту надо сказат --make-pidfile --pidfile |
115 |
> /run/searchd-test.pid? |
116 |
> |
117 |
> Кстати, а зачем --make-pidfile, если демон сам их создает: |
118 |
> |
119 |
> # cat /etc/sphinx/sphinx.conf | grep pid |
120 |
> pid_file = /run/searchd.pid |
121 |
> |
122 |
> # cat /etc/sphinx/sphinx-test.conf | grep pid |
123 |
> pid_file = /run/searchd-test.pid |
124 |
> |
125 |
> ? |
126 |
|
127 |
Извините, что встреваю, но данное действие можно сделать одним |
128 |
init-скриптом и симлинком на него(оригинальный скрипт, понятное дело |
129 |
прийдется изменить). conf.d файла нужно будет 2(например sphinx и |
130 |
sphinx.test, соответственно скрипт будет sphinx а симлинк - sphinx.test. |
131 |
Разруливать всё это можно будет через переменную ${SVCNAME}). А патч |
132 |
отправить на bugs.gentoo.org. Если активности в баге особой не будет - |
133 |
можно будет аккуратно пнуть мэйнтэйнеров. Я поспособствую ;-) |
134 |
|
135 |
В чем преимущество? В том, что в данной схеме можно будет запустить |
136 |
3,5,10,сколько_позволит_железо копий sphinx |
137 |
|
138 |
-- |
139 |
Best regards, Sergey Popov |
140 |
Gentoo Linux Developer |
141 |
Desktop-effects project lead |