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

View File

@ -11,7 +11,7 @@
Summary: LDAP support libraries Summary: LDAP support libraries
Name: openldap Name: openldap
Version: %{version} Version: %{version}
Release: 5%{?dist} Release: 6%{?dist}
License: OpenLDAP License: OpenLDAP
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: ftp://ftp.OpenLDAP.org/pub/OpenLDAP/openldap-release/openldap-%{version}.tgz 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. # Install an init script for the servers.
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d 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 # Install syconfig/ldap
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
@ -561,7 +561,7 @@ fi
%attr(0644,root,root) %doc DB_CONFIG.example %attr(0644,root,root) %doc DB_CONFIG.example
%doc README.schema %doc README.schema
%ghost %config(noreplace) %{_sysconfdir}/pki/tls/certs/slapd.pem %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(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/ldap*.conf
%attr(0640,root,ldap) %config(noreplace) %{_sysconfdir}/openldap/slapd.conf %attr(0640,root,ldap) %config(noreplace) %{_sysconfdir}/openldap/slapd.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/ldap %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/ldap
@ -606,6 +606,9 @@ fi
%attr(0644,root,root) %{evolution_connector_libdir}/*.a %attr(0644,root,root) %{evolution_connector_libdir}/*.a
%changelog %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 * Thu Aug 27 2009 Tomas Mraz <tmraz@redhat.com> - 2.4.16-5
- rebuilt with new openssl - rebuilt with new openssl