ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: devel@lists.altlinux.org
Subject: [devel] Fwd: Re: [Comm] Re: init.d cкрипты для apache/samba опускают чужие экземляры
Date: Tue, 20 Dec 2005 13:17:38 +0200
Message-ID: <20051220111738.GI27103@osdn.org.ua> (raw)

[-- Attachment #1: Type: text/plain, Size: 329 bytes --]

	Здравствуйте.
Тут кой-чего запостили, решил, что стоит более разработческого
внимания.

http://lists.altlinux.ru/pipermail/community/2005-December/171914.html
http://lists.altlinux.ru/pipermail/community/2005-December/171954.html

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

[-- Attachment #2: Type: message/rfc822, Size: 9237 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 1965 bytes --]

Michael Shigorin пишет:
> On Wed, Dec 14, 2005 at 11:19:26PM +0300, Vlad Borisoff wrote:
> 
>>В  случае,  если  запущены  несколько экземпляров apache и/или
>>samba с разными конфигурационными файлами, /etc/init.d/httpd*
>>/etc/init.d/smb* скрипты опускают все экземляры (поднимаются
>>экземляры без проблем).
> 
> 
> Да.
> 
> 
>>Проблема с /etc/init.d/httpd связана, как я понял с тем, что
>>программа start-stop-daemon  учитывает  не  только  pidfile,
>>но и имя процесса: таким  образом  убивая  все процессы с
>>именем libhttpd.ep (ну и к тому же, ниже вызова функции
>>stop_daemon libhttpd.ep дополниельно убиваются через  killall).
> 
> 
> Да... источник проблемы, которая *редко* приводит к залипанию
> одного из детишек на :80 (или где ещё) и как следствие -- морозит
> перезапуск сервера -- где-то сильно глубоко, судя по обсуждению 
> в апачевых рассылках.
> 
> Пришлось внедрить такой workaround, до этого он жил
> в рестарт-скрипте monit у нас.
> 
> 
>>Существует  ли какое-либо простое решение организации
>>запуска/останова нескольких  экземпляров  процессов
>>apache/samba  в  дистрибутиве  ALT Linux?  или  это  считается
>>абсолютно ненужным и совершенно не стоящим внимания?
Что-то начало треда я пропустил... Но судя по контексту решение есть. У 
меня нормально пускаются/останавливаются несколько отдельных httpd 
серверов. Вот в аттаче один из скриптов /etc/rc.d/init.d/httpd*
Технология такая:
1. делаем ln -s /usr/sbin/httpd /usr/sbin/httpd-whatever
2. добавляем юзера whatever, под которым будет работать сервер
3. скрипт копируется в /etc/rc.d/init.d/httpd-whatever,
в нем везде меняем gysmeteo на whatever
(везде - это переменные  BINARY PIDFILE PERLPIDFILE LOCKFILE CFGFILE 
STATUSURL)
4. Осталось только создать нужную структуру каталогов для whatever и 
правильно написать httpd.conf
ls ~gysmeteo/*
/home/gysmeteo/httpd:
conf  logs  modules

/home/gysmeteo/tmp:
mc-gysmeteo

/home/gysmeteo/www:
cgi-bin  html  icons  protected-cgi-bin


[-- Attachment #2.1.2: httpd-gysmeteo --]
[-- Type: text/plain, Size: 3448 bytes --]

#! /bin/sh
#
# httpd          Start/Stop the Apache Web Server
#
# chkconfig: 345 80 15
# description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/httpd.conf

WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

BINARY=/usr/sbin/httpd-gysmeteo
PIDFILE=/var/run/httpd-gysmeteo.pid
PERLPIDFILE=/var/run/httpd-perl-gysmeteo.pid
LOCKFILE=/var/lock/subsys/httpd-gysmeteo
RETVAL=0
#vod
CFGFILE=/home/gysmeteo/httpd/conf/httpd.conf

export TMPDIR=/tmp

### Hack for bad hostname configuration
#vod thehost=`hostname`
#vod hostname -i 1>/dev/null 2>/dev/null|| hostname localhost

### Hack for Status
LYNX="lynx -dump"
STATUSURL="http://www.gysmeteo.ru/server-status"

# Change the major functions into functions.
moduleargs() {
	moduledir=/usr/lib/apache
	moduleargs=
	for module in ${moduledir}/*.so ; do
		if [ -x ${module} ] ; then
			module=`echo ${module} | 
			sed -e 's/.*\///g; s/^mod_//g; s/^lib//g; s/\.so//g;'|
			tr '[:lower:]' '[:upper:]'`
			moduleargs="${moduleargs} -DHAVE_$module"
		fi
	done
	echo ${moduleargs}
}

conftest() {
	# TODO: translatable form?
	action "Checking configuration sanity for `basename $BINARY`: " \
		"$BINARY" -t `moduleargs` $DEFINE -f "$CFGFILE"
	RETVAL=$?
	return $RETVAL
}

start()
{
	if [ "$1" != "again" ]; then
		if status --pidfile "$PERLPIDFILE" --expect-user root \
			  --expect-user root -- httpd-perl >&/dev/null; then
			echo "Warning: httpd-perl is already running, check 'service `basename $BINARY` status' now"
			passed "httpd-perl already running"
		fi
	fi
	start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" \
		--expect-user root --name libhttpd.ep -- $BINARY -f "$CFGFILE"
	RETVAL=$?
	return $RETVAL
}

stop()
{
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" \
		--expect-user root --name libhttpd.ep -- $BINARY
	if [ "$1" != "nocheck" -a -f "$PERLPIDFILE" ]; then
		echo "Warning: httpd-perl is running, check 'service httpd-perl extendedstatus'"
		passed "httpd-perl already running"
	fi
	RETVAL=$?
	return $RETVAL
}

reload()
{
	msg_reloading `basename $BINARY`
	stop_daemon --pidfile "$PIDFILE" \
		--expect-user root --name libhttpd.ep -HUP -- $BINARY
	RETVAL=$?
	return $RETVAL
} 

restart()
{
	stop nocheck
	conftest || _exit $?
	start again
}

briefstatus()
{
	status --pidfile "$PIDFILE" --expect-user root \
		--expect-user root --name libhttpd.ep -- $BINARY
	RETVAL=$?
	return $RETVAL
}

extendedstatus()
{
	if briefstatus >/dev/null; then
	    RETVAL=$?
	    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '	
	else
	    RETVAL=$?
	    msg_not_running "`basename $BINARY`"
	    echo
	fi
	return $RETVAL
}

_exit() {
	hostname $thehost
	exit $1
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	reload|graceful)
		if [ -e /usr/lib/apache/mod_jserv.so ]; then
			restart
		else
			reload
		fi
		;;
	check|configtest)
		conftest
		_exit $?
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	update|condrestart)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	condreload)
		if [ -e "$LOCKFILE" ]; then
			reload
		fi
		;;
	extendedstatus)
		extendedstatus
		;;
	status)
		briefstatus
		;;
	*)
		msg_usage "${0##*/} {start|stop|reload|restart|check|configtest|condstop|condrestart|condreload|status}"
		RETVAL=1
esac

_exit $RETVAL

[-- Attachment #2.1.3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
Community mailing list
Community@lists.altlinux.org
https://lists.altlinux.org/mailman/listinfo/community

             reply	other threads:[~2005-12-20 11:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-20 11:17 Michael Shigorin [this message]
2005-12-20 11:48 ` Epiphanov Sergei
2005-12-20 14:43   ` [devel] [JT] " Michael Shigorin
2005-12-20 18:34   ` [devel] " Денис Смирнов
2005-12-21  8:32     ` Epiphanov Sergei
2005-12-21 12:10       ` [devel] " Michael Shigorin
2005-12-21 12:17       ` [devel] " Денис Смирнов
2005-12-21 13:40         ` [devel] " Vitaly Ostanin
2005-12-21 14:31           ` Денис Смирнов
2005-12-21 22:24         ` Konstantin A. Lepikhov
2005-12-21 22:27           ` [devel] vserver Dmitry V. Levin
2005-12-21 22:31             ` [devel] vserver Konstantin A. Lepikhov
2005-12-21 22:43               ` [devel] kernel-2.4.x Dmitry V. Levin
2005-12-25 21:09                 ` Sergey Vlasov
2005-12-25 21:21                   ` Sergey Vlasov
2005-12-27 17:50                     ` Dmitry V. Levin
2005-12-27 18:28                       ` Sergey Vlasov
2005-12-27 20:01                         ` Dmitry V. Levin
2005-12-28  9:04                           ` [devel] kernel-2.4.x Konstantin A. Lepikhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051220111738.GI27103@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git