Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37902634
en ru br
Репозитории ALT
S:2.6.4-alt1
5.1: 2.4.5-alt2
4.1: 2.4.5-alt0.1.M41.1
4.0: 2.4.5-alt0.1.M40.1
3.0: 2.4.1-alt7
www.altlinux.org/Changes

Группа :: Система/Серверы
Пакет: inn

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

#! /bin/sh
#
# /etc/init.d/innd
#
# innd InterNet News System
#
# chkconfig: - 95 05
# description: in2n is the most popular server for Usenet news. It allows \
# you to setup local news servers. It can be difficult to \
# set up properly though, so be sure to read /usr/doc/inn* \
# before trying.
# processname: innd
# pidfile: /var/run/news/innd.pid

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

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

# Source config.
SourceIfNotEmpty /usr/lib/inn/innshellvars

INND_LOCKFILE=/var/lock/subsys/innd
INND_PIDFILE=/var/run/news/innd.pid

OVDB_LOCKFILE=/var/lock/subsys/ovdb_monitor
OVDB_PIDFILE=/var/run/news/ovdb_monitor.pid

RETVAL=0

## RFLAG is set below; set INNFLAGS in inn.conf(5)
RFLAG=""

do_history_init()
{
# You might want to rebuild the DBZ database, too:
if [ ! -f ${PATHDB}/history.dir ]; then
su news -s /bin/sh -c "/usr/bin/makedbz -i"
su news -s /bin/sh -c "cd ${PATHDB} \
&& mv history.n.dir history.dir \
&& mv history.n.hash history.hash \
&& mv history.n.index history.index "
fi
}

do_active_init()
{
## Active file recovery.
if [ ! -s ${ACTIVE} ] ; then
if [ -s ${NEWACTIVE} ] ; then
su news -s /bin/sh -c "mv ${NEWACTIVE} ${ACTIVE}"
else
if [ -s ${OLDACTIVE} ] ; then
su news -s /bin/sh -c "cp ${OLDACTIVE} ${ACTIVE}"
else
msg_starting innd
failure "INND: No active file!"
echo
RETVAL=1
return
fi
fi
RFLAG="-r"
fi
}

do_ovdb_start()
{
## Initialize ovdb. Must be done before starting innd.
if [ "$OVMETHOD" = "ovdb" ]; then
msg_starting $"ovdb"
start_daemon --no-announce --pidfile "$OVDB_PIDFILE" --lockfile "$OVDB_LOCKFILE" --user news --expect-user news --name ovdb_monitor /usr/bin/ovdb_init || {
RETVAL=$?
return $RETVAL
}
fi
}

do_ovdb_stop()
{
# Turn off ovdb support procs, and close the DB environment
if [ "$OVMETHOD" = "ovdb" -a -f ${PATHRUN}/ovdb_server.pid ]; then
stop_daemon --pidfile "${PATHRUN}/ovdb_server.pid" --expect-user news ovdb_server
fi

if [ "$OVMETHOD" = "ovdb" -a -f $OVDB_PIDFILE ]; then
stop_daemon --pidfile "$OVDB_PIDFILE" --lockfile "$OVDB_LOCKFILE" --expect-user news ovdb_monitor
fi

}

start()
{
if [ -f $INND_PIDFILE ] ; then
FLAGS="--start --exec /usr/bin/innd --pidfile $INND_PIDFILE --user news"
if start-stop-daemon $FLAGS --test > /dev/null; then
RFLAG="-r"
## Remove temporary batchfiles and lock files.
( cd ${BATCH} && rm -f bch* )
( cd ${LOCKS} && rm -f LOCK* )
( cd ${TEMPSOCKDIR} && rm -f ${TEMPSOCK} )
rm -f ${NEWSCONTROL} ${NNTPCONNECT} $INND_PIDFILE
fi
fi

do_history_init
do_active_init
do_ovdb_start

msg_starting $"innd"
start_daemon --no-announce --pidfile "$INND_PIDFILE" --lockfile "$INND_LOCKFILE" --expect-user news --name innd ${INNDSTART} ${RFLAG} ${INNFLAGS}
RETVAL=$?
}


stop()
{
do_ovdb_stop

stop_daemon --pidfile "$INND_PIDFILE" --lockfile "$INND_LOCKFILE" --expect-user news innd
RETVAL=$?
return $RETVAL

}

restart()
{
stop
start
}

reload()
{
stop
start
}

# 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 "$INND_LOCKFILE" ]; then
stop
fi
;;
condrestart)
# Restart the servce if it is already running, for example:
if [ -e "$INND_LOCKFILE" ]; then
restart
fi
;;
condreload)
if [ -e "$INND_LOCKFILE" ]; then
reload
fi
;;
status)
status --pidfile "$INND_PIDFILE" --expect-user news innd
RETVAL=$?
;;
*)
echo "Usage: ${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
RETVAL=1
esac

exit $RETVAL
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin