[mdk-re] Custom initscript

vic ismakaev =?iso-8859-1?q?viclists_=CE=C1_mail=2Eesoo=2Eru?=
Вт Апр 16 16:12:36 MSD 2002


Очередная проблема:
Создал initscript для cyrus-imap сервера,положил его в /etc/rc.d/init.d ,
но :
1)он не хочет регистрироватся по 
chkconfig --add cyrus
[root на devel1 init.d]# chkconfig --add cyrus
service cyrus does not support chkconfig

2) когда говорю
service cyrus start - не появляется сообщение [OK], хотя все нормально 
запускается и $RETVAL=0.
Причем service cyrus stop - все нормально и показывается [OK].

Файл ниже:

-----------------------------------------------------------
 #!/bin/sh
#
#	/etc/init.d/cyrus
#
#	Cyrus IMAP/POP3 daemon with virtual accounts of users
#	(implemented by SASL mechanism with PAM,LDAP,KERBEROS
#	authentification and authorization)
#	Provides: cyrus
#	Requires: network
#chkconfig:  2345 76 45
#
#	<tags -- see below for tag definitions.
#	*Every line* from the top of the file to the end of the tags section
#	must begin with a #	character. After the tags section, there should
#	be a blank line. This keeps normal comments in the rest of the file
#	from being mistaken for tags, should they happen to fit the pattern.>

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

#<source configuration/library files if required>
SourceIfNotEmpty /etc/sysconfig/network &&
        [ "$NETWORKING" != no ] ||
		        exit

#<define any local shell functions used by the code that follows>
CYRUS_BIN=/usr/cyrus/bin/master
test -x $CYRUS_BIN || exit

RETVAL=0
LOCKFILE=/var/lock/subsys/cyrus

start()
{
	echo -n "Starting cyrus: "
	# start daemons, perhaps with the daemon function, for example:
	daemon $CYRUS_BIN &
	RETVAL=$?
#	echo $RETVAL
	echo
	[ $RETVAL -eq 0 ] && touch "$LOCKFILE"
	return $RETVAL
}

stop()
{
	echo -n "Shutting down cyrus: "
	# stop daemons, perhaps with the killproc function, for example:
	killproc $CYRUS_BIN
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f "$LOCKFILE"
	return $RETVAL
}

restart()
{
	stop
	start
}

reload()
{
	# cause the service configuration to be reread, either with kill -HUP:
	echo -n "Reloading <servicename>: "
	killproc <servicename> -HUP
	RETVAL=$?
	echo
	# or by simple restarting the daemons in a manner similar to restart above.
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	reload)
		reload
		;;
	restart)
		restart
		;;
	condstop)
		# Stop the servce if it is already running, for example:
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart)
		# Restart the servce if it is already running, for example:
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	status)
		# report the status of the daemons in free-form format,
		# perhaps with the status function, for example:
		status cyrus
		RETVAL=$?
		;;
	probe)
		;;
		# optional. If it exists, then it should determine whether
		# or not the service needs to be restarted or reloaded (or
		# whatever) in order to activate any changes in the configuration
		# scripts. It should print out a list of commands to give to
		# $0; see also description of the probe tag.
	*)
		echo "Usage: ${0##*/} 
{start|stop|reload|restart|condstop|condrestart|status[|probe]}"
		RETVAL=1
esac

exit $RETVAL

-- 
С уважением
Виктор В Исмакаев




Подробная информация о списке рассылки community