- make init script LSB-compliant (#523227)
This commit is contained in:
parent
574f83ac82
commit
634b995505
115
cyrus-imapd.init
115
cyrus-imapd.init
@ -11,45 +11,28 @@
|
|||||||
# version: 2005111100
|
# version: 2005111100
|
||||||
# changed: add quickstart/stop option to init script to bypass db import/export
|
# changed: add quickstart/stop option to init script to bypass db import/export
|
||||||
|
|
||||||
# Source function library
|
. /etc/init.d/functions
|
||||||
if [ -f /etc/init.d/functions ]; then
|
|
||||||
. /etc/init.d/functions
|
config=/etc/imapd.conf
|
||||||
elif [ -f /etc/rc.d/init.d/functions ]; then
|
config2=/etc/cyrus.conf
|
||||||
. /etc/rc.d/init.d/functions
|
exec=/usr/lib/cyrus-imapd/cyrus-master
|
||||||
else
|
lockfile=/var/lock/subsys/cyrus-imapd
|
||||||
exit 0
|
pidfile=/var/run/cyrus-master.pid
|
||||||
|
prog="cyrus-imapd"
|
||||||
|
|
||||||
|
if [ -f /etc/sysconfig/dovecot ]; then
|
||||||
|
. /etc/sysconfig/dovecot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Source networking configuration.
|
|
||||||
. /etc/sysconfig/network
|
|
||||||
|
|
||||||
# Check that networking is up.
|
|
||||||
[ ${NETWORKING} = "no" ] && exit 0
|
|
||||||
|
|
||||||
# check if the config files are present
|
# check if the config files are present
|
||||||
[ -f /etc/cyrus.conf ] || exit 0
|
configok=true
|
||||||
[ -f /etc/imapd.conf ] || exit 0
|
[ -f $config -a $config2 ] || configok=false
|
||||||
|
|
||||||
# This is our service name
|
|
||||||
BASENAME=$(basename $0)
|
|
||||||
if [ -L $0 ]; then
|
|
||||||
BASENAME=$(find $0 -name $BASENAME -printf %l)
|
|
||||||
BASENAME=$(basename $BASENAME)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source service configuration.
|
|
||||||
if [ -f /etc/sysconfig/$BASENAME ]; then
|
|
||||||
. /etc/sysconfig/$BASENAME
|
|
||||||
else
|
|
||||||
echo "$BASENAME: configfile /etc/sysconfig/$BASENAME does NOT exist !"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get_config [config default]
|
# get_config [config default]
|
||||||
# extracts config option from config file
|
# extracts config option from config file
|
||||||
get_config() {
|
get_config() {
|
||||||
if config=$(grep "^$1" /etc/imapd.conf); then
|
if conf=$(grep "^$1" /etc/imapd.conf); then
|
||||||
echo $config | cut -d: -f2
|
echo $conf | cut -d: -f2
|
||||||
else
|
else
|
||||||
echo $2
|
echo $2
|
||||||
fi
|
fi
|
||||||
@ -61,66 +44,65 @@ CYRUSMASTER=/usr/lib/cyrus-imapd/cyrus-master
|
|||||||
CYRUS_PROC_NAME=$(basename $CYRUSMASTER)
|
CYRUS_PROC_NAME=$(basename $CYRUSMASTER)
|
||||||
ALWAYS_CONVERT=1
|
ALWAYS_CONVERT=1
|
||||||
|
|
||||||
# fallback to su if runuser not available
|
|
||||||
if [ -x /sbin/runuser ]; then
|
|
||||||
RUNUSER=runuser
|
|
||||||
else
|
|
||||||
RUNUSER=su
|
|
||||||
fi
|
|
||||||
|
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
RETVAL2=1
|
RETVAL2=1
|
||||||
QUICK=0
|
QUICK=0
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
[ $UID -eq 0 ] || exit 4
|
||||||
|
[ -x $exec ] || exit 5
|
||||||
|
$configok || exit 6
|
||||||
if [ $(/sbin/pidof -s $CYRUSMASTER) ]; then
|
if [ $(/sbin/pidof -s $CYRUSMASTER) ]; then
|
||||||
echo -n $"$BASENAME already running."
|
echo -n $"$prog already running."
|
||||||
false
|
true
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
if [ $QUICK -eq 0 ]; then
|
if [ $QUICK -eq 0 ]; then
|
||||||
echo -n $"Importing $BASENAME databases: "
|
echo -n $"Importing $prog databases: "
|
||||||
cd $CONFIGDIRECTORY
|
cd $CONFIGDIRECTORY
|
||||||
$RUNUSER - cyrus -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all > ${CONFIGDIRECTORY}/rpm/db_import.log 2>&1" < /dev/null
|
runuser - cyrus -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all > ${CONFIGDIRECTORY}/rpm/db_import.log 2>&1" < /dev/null
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
success $"$BASENAME importing databases"
|
success $"$prog importing databases"
|
||||||
else
|
else
|
||||||
failure $"$BASENAME error importing databases, check ${CONFIGDIRECTORY}/rpm/db_import.log"
|
failure $"$prog error importing databases, check ${CONFIGDIRECTORY}/rpm/db_import.log"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
if [ $RETVAL -eq 0 ]; then
|
if [ $RETVAL -eq 0 ]; then
|
||||||
echo -n $"Starting $BASENAME: "
|
echo -n $"Starting $prog: "
|
||||||
daemon $CYRUSMASTER -d $CYRUSOPTIONS
|
daemon $CYRUSMASTER -d $CYRUSOPTIONS
|
||||||
RETVAL2=$?
|
RETVAL2=$?
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/$BASENAME
|
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch $lockfile
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
echo -n $"Shutting down $BASENAME: "
|
[ $UID -eq 0 ] || exit 4
|
||||||
|
[ -x $exec ] || exit 5
|
||||||
|
|
||||||
|
echo -n $"Shutting down $prog: "
|
||||||
killproc $CYRUSMASTER
|
killproc $CYRUSMASTER
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $QUICK -eq 0 ]; then
|
if [ $QUICK -eq 0 ]; then
|
||||||
if [ ! $(/sbin/pidof -s $CYRUSMASTER) ]; then
|
if [ ! $(/sbin/pidof -s $CYRUSMASTER) ]; then
|
||||||
echo
|
echo
|
||||||
echo -n $"Exporting $BASENAME databases: "
|
echo -n $"Exporting $prog databases: "
|
||||||
cd $CONFIGDIRECTORY
|
cd $CONFIGDIRECTORY
|
||||||
$RUNUSER - cyrus -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all export > ${CONFIGDIRECTORY}/rpm/db_export.log 2>&1" < /dev/null
|
runuser - cyrus -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all export > ${CONFIGDIRECTORY}/rpm/db_export.log 2>&1" < /dev/null
|
||||||
RETVAL2=$?
|
RETVAL2=$?
|
||||||
if [ $RETVAL2 -eq 0 ]; then
|
if [ $RETVAL2 -eq 0 ]; then
|
||||||
success $"$BASENAME exporting databases"
|
success $"$prog exporting databases"
|
||||||
else
|
else
|
||||||
failure $"$BASENAME error exporting databases, check ${CONFIGDIRECTORY}/rpm/db_export.log"
|
failure $"$prog error exporting databases, check ${CONFIGDIRECTORY}/rpm/db_export.log"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
|
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f $lockfile
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,16 +119,6 @@ reload() {
|
|||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
condrestart() {
|
|
||||||
[ -e /var/lock/subsys/$BASENAME ] && restart || :
|
|
||||||
}
|
|
||||||
|
|
||||||
rhstatus() {
|
|
||||||
status $CYRUSMASTER
|
|
||||||
RETVAL=$?
|
|
||||||
return $RETVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
start
|
start
|
||||||
@ -154,17 +126,21 @@ case "$1" in
|
|||||||
stop)
|
stop)
|
||||||
stop
|
stop
|
||||||
;;
|
;;
|
||||||
restart)
|
force-reload|restart)
|
||||||
restart
|
restart
|
||||||
;;
|
;;
|
||||||
reload)
|
reload)
|
||||||
reload
|
reload
|
||||||
;;
|
;;
|
||||||
condrestart)
|
condrestart|try-restart)
|
||||||
condrestart
|
if [ -f $lockfile ]; then
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
rhstatus
|
status -p $pidfile $prog
|
||||||
|
RETVAL=$?
|
||||||
;;
|
;;
|
||||||
quickstart)
|
quickstart)
|
||||||
QUICK=1
|
QUICK=1
|
||||||
@ -175,8 +151,9 @@ case "$1" in
|
|||||||
stop
|
stop
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status|quickstart|quickstop}"
|
echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status|quickstart|quickstop}"
|
||||||
RETVAL=1
|
RETVAL=2
|
||||||
|
[ "$1" = "usage" ] && RETVAL=0
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Name: cyrus-imapd
|
Name: cyrus-imapd
|
||||||
Version: 2.3.15
|
Version: 2.3.15
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
|
|
||||||
# ********************** BUILD TIME OPTIONS START **********************
|
# ********************** BUILD TIME OPTIONS START **********************
|
||||||
|
|
||||||
@ -731,6 +731,9 @@ fi
|
|||||||
%{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 18 2009 Michal Hlavinka <mhlavink@redhat.com> - 2.3.15-2
|
||||||
|
- make init script LSB-compliant (#523227)
|
||||||
|
|
||||||
* Fri Sep 18 2009 Michal Hlavinka <mhlavink@redhat.com> - 2.3.15-1
|
* Fri Sep 18 2009 Michal Hlavinka <mhlavink@redhat.com> - 2.3.15-1
|
||||||
- fix buffer overflow in cyrus sieve (CVE-2009-3235)
|
- fix buffer overflow in cyrus sieve (CVE-2009-3235)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user