updated init script to be LSB-compliant (#523434)

This commit is contained in:
Jan Zeleny 2009-09-16 14:06:36 +00:00
parent f076e6e7ed
commit 5dec44106b
2 changed files with 32 additions and 17 deletions

View File

@ -8,10 +8,10 @@
# for implementing the industry standard directory services.
# processname: slapd
# config: /etc/openldap/slapd.conf
# pidfile: /var/run/openldap/slapd.pid
# pidfile: /var/run/slapd.pid
### BEGIN INIT INFO
# Provides: ldap
# Provides: slapd
# Required-Start: $network $local_fs
# Required-Stop: $network $local_fs
# Should-Start:
@ -41,9 +41,10 @@ fi
slapd=/usr/sbin/slapd
slaptest=/usr/sbin/slaptest
lockfile=/var/lock/subsys/ldap
lockfile=/var/lock/subsys/slapd
configfile=/etc/openldap/slapd.conf
pidfile=/var/run/openldap/slapd.pid
pidfile=/var/run/slapd.pid
slapd_pidfile=/var/run/openldap/slapd.pid
RETVAL=0
@ -163,6 +164,7 @@ function configtest() {
function start() {
[ -x $slapd ] || exit 5
[ `id -u` -eq 0 ] || exit 4
configtest
# Define a couple of local variables which we'll need. Maybe.
user=ldap
@ -181,7 +183,10 @@ function start() {
echo -n $"Starting $prog: "
daemon --pidfile=$pidfile --check=$prog ${slapd} -h "\"$harg\"" -u ${user} $OPTIONS $SLAPD_OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
if [ $RETVAL -eq 0 ]; then
touch $lockfile
ln $slapd_pidfile $pidfile
fi
echo
return $RETVAL
}
@ -189,10 +194,15 @@ function start() {
function stop() {
# Stop daemons.
prog=`basename ${slapd}`
[ `id -u` -eq 0 ] || exit 4
echo -n $"Stopping $prog: "
killproc -p $pidfile -d $SLAPD_SHUTDOWN_TIMEOUT ${slapd}
# This will remove pid and args files from /var/run/openldap
killproc -p $slapd_pidfile -d $SLAPD_SHUTDOWN_TIMEOUT ${slapd}
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile /var/run/slapd.args
# Now we want to remove lock file and hardlink of pid file
[ $RETVAL -eq 0 ] && rm -f $pidfile $lockfile
echo
return $RETVAL
}
@ -220,15 +230,17 @@ case "$1" in
RETVAL=$?
;;
condrestart|try-restart)
if [ -f /var/lock/subsys/ldap ] ; then
stop
start
RETVAL=$?
fi
status -p $pidfile ${slapd} || exit 0
stop
start
;;
usage)
echo $"Usage: $0 {start|stop|restart|status|condrestart|configtest|usage}"
RETVAL=0
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart|configtest}"
RETVAL=2
echo $"Usage: $0 {start|stop|restart|status|condrestart|configtest|usage}"
RETVAL=3
esac
exit $RETVAL

View File

@ -11,7 +11,7 @@
Summary: LDAP support libraries
Name: openldap
Version: %{version}
Release: 5%{?dist}
Release: 6%{?dist}
License: OpenLDAP
Group: System Environment/Daemons
Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz
@ -359,7 +359,7 @@ rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/openldap/schema/*.default
# Install an init script for the servers.
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
install -m 755 %SOURCE4 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ldap
install -m 755 %SOURCE4 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/slapd
# Install syconfig/ldap
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
@ -561,7 +561,7 @@ fi
%attr(0644,root,root) %doc DB_CONFIG.example
%doc README.schema
%ghost %config(noreplace) %{_sysconfdir}/pki/tls/certs/slapd.pem
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/ldap
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/slapd
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/ldap*.conf
%attr(0640,root,ldap) %config(noreplace) %{_sysconfdir}/openldap/slapd.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/ldap
@ -606,6 +606,9 @@ fi
%attr(0644,root,root) %{evolution_connector_libdir}/*.a
%changelog
* Wed Sep 16 2009 Jan Zeleny <jzeleny@redhat.com> 2.4.16-6
- updated init script to be LSB-compliant (#523434)
* Thu Aug 27 2009 Tomas Mraz <tmraz@redhat.com> - 2.4.16-5
- rebuilt with new openssl