[tomcat6] Update to 6.0.35; Add post for systemv package to execute chkconfig on install and uninstall. Resolv
Dave Knox
dknox at fedoraproject.org
Wed Mar 21 18:10:52 UTC 2012
commit d7479acb29120d5e60f0f9b368c901fc2df120c5
Author: David Knox <dknox at dknox-laptop.(none)>
Date: Wed Mar 21 12:10:27 2012 -0600
Update to 6.0.35; Add post for systemv package to execute chkconfig on install and uninstall. Resolves a missing service error during rpm install; Permissions of system files agree between systemv init script and spec file; Add routine to sysd script to erase pid file and lock file when stopped; TOMCAT_LOG now defines logs for the systemv and systemd files versus catalina.out. Tomcat still writes to catalina.out. The init scripts write to tomcat6-initd and tomcat6-sysd
tomcat6-6.0-tomcat6-sysd | 26 ++++++++++++++++++++++----
tomcat6.spec | 44 ++++++++++++++++++++++++++++++++------------
2 files changed, 54 insertions(+), 16 deletions(-)
---
diff --git a/tomcat6-6.0-tomcat6-sysd b/tomcat6-6.0-tomcat6-sysd
index 30185d6..6459b0c 100644
--- a/tomcat6-6.0-tomcat6-sysd
+++ b/tomcat6-6.0-tomcat6-sysd
@@ -64,12 +64,12 @@ function start() {
export CATALINA_PID="/var/run/${NAME}.pid"
touch $CATALINA_PID 2>&1
if [ "$?" -eq "0" ]; then
- chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID
+ chown root:${TOMCAT_USER} $CATALINA_PID
fi
touch $TOMCAT_LOG 2>&1
if [ "$?" -eq "0" ]; then
- chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG
+ chown root:${TOMCAT_USER} $TOMCAT_LOG
fi
parseOptions
@@ -80,9 +80,27 @@ function start() {
fi
}
-function stop() {
+function stop(){
parseOptions
- $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1
+ touch /var/lock/subsys/${NAME} 2>&1
+ $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> ${TOMCAT_LOG} 2>&1
+ count="0"
+ if [ -f "/var/run/${NAME}.pid" ]; then
+ read kpid < /var/run/${NAME}.pid
+ until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \
+ [ "$count" -gt "$SHUTDOWN_WAIT" ]; do
+ if [ "$SHUTDOWN_VERBOSE" = "true" ]; then
+ echo "waiting for processes $kpid to exit"
+ fi
+ sleep 1
+ let count="${count}+1"
+ done
+ if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
+ kill -9 $kpid
+ fi
+ log_success_msg
+ rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid
+ fi
}
# See how we were called.
diff --git a/tomcat6.spec b/tomcat6.spec
index 2ca5d43..c8c85a9 100644
--- a/tomcat6.spec
+++ b/tomcat6.spec
@@ -157,6 +157,8 @@ Javadoc generated documentation for Apache Tomcat.
Group: System Environment/Applications
Summary: Systemv scripts for Apache Tomcat
Requires: %{name} = %{epoch}:%{version}-%{release}
+Requires(post): chkconfig
+Requires(preun): chkconfig
%description systemv
SystemV scripts to start and stop tomcat6 service
@@ -340,8 +342,6 @@ popd
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper
-#%{__install} -m 755 %{SOURCE11} ${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service
-#%{__install} -m 755 %{SOURCE12} ${RPM_BUILD_ROOT}%{_sbindir}/%{name}-sysd
# create jsp and servlet API symlinks
pushd ${RPM_BUILD_ROOT}%{_javadir}
%{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api.jar
@@ -442,18 +442,23 @@ done
# Save the conf, app, and lib dirs
# due to rbgz 640686. Copy them to the _tmppath so we don't pollute
# the tomcat file structure
-[ -d %{appdir} ] && %{__cp} -rp %{appdir} %{_tmppath}/%{name}-webapps.bak || :
-[ -d %{confdir} ] && %{__cp} -rp %{confdir} %{_tmppath}/%{name}-confdir.bak || :
-[ -d %{libdir} ] && %{__cp} -rp %{libdir} %{_tmppath}/%{name}-libdir.bak || :
+#[ -d %{appdir} ] && %{__cp} -rp %{appdir} %{_tmppath}/%{name}-webapps.bak || :
+#[ -d %{confdir} ] && %{__cp} -rp %{confdir} %{_tmppath}/%{name}-confdir.bak || :
+#[ -d %{libdir} ] && %{__cp} -rp %{libdir} %{_tmppath}/%{name}-libdir.bak || :
%post
# install but don't activate
+#/sbin/chkconfig --add %{name}
if [ $1 -eq 1 ]; then
#initial installation
- /sbin/chkconfig --add %{name}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
+%post systemv
+if [ $1 -eq 1 ]; then
+ /sbin/chkconfig --add %{name}
+fi
+
%post jsp-%{jspspec}-api
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20100
@@ -495,17 +500,23 @@ fi
%preun
if [ "$1" = "0" ]; then
- %{_initrddir}/%{name} stop > /dev/null 2>&1
- /sbin/chkconfig --del %{name}
+# %{_initrddir}/%{name} stop > /dev/null 2>&1
+# /sbin/chkconfig --del %{name}
# package removal, not upgrade
/bin/systemctl --no-reload disable tomcat6.service > /dev/null 2>&1 || :
/bin/systemctl stop tomcat6.service > /dev/null 2>&1 || :
fi
+%preun systemv
+if [ "$1" = "0" ]; then
+ %{_initrddir}/%{name} stop > /dev/null 2>&1
+ /sbin/chkconfig --del %{name}
+fi
+
%postun
+/bin/systemctl daemon-reload > /dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
#package upgrade, not uninstall
- /bin/systemctl daemon-reload > /dev/null 2>&1 || :
/bin/systemctl try-restart tomcat6.service > /dev/null 2>&1 || :
fi
@@ -555,7 +566,8 @@ fi
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/*.properties
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/context.xml
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/server.xml
-%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/log4j.properties
+# will cause duplication in file list
+#%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/log4j.properties
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml
%attr(0666,tomcat,tomcat) %config(noreplace) %{confdir}/web.xml
%attr(0775,root,tomcat) %dir %{cachedir}
@@ -630,11 +642,19 @@ fi
%changelog
* Mon Feb 06 2012 david knox <dknox at redhat.com> 0:6.0.35-1
- Update to 6.0.35
+- Add post for systemv package to execute chkconfig on
+- install and uninstall. Resolves a missing service error during
+- rpm install.
+- Permissions of system files agree between systemv init script and spec file.
+- Add routine to sysd script to erase pid file and lock file when stopped
+- TOMCAT_LOG now defines logs for the systemv and systemd files versus
+- catalina.out. Tomcat still writes to catalina.out. The init scripts write
+- to tomcat6-initd and tomcat6-sysd
* Mon Jan 19 2012 david Knox <dknox at redhat.com> 0:6.0.32-21
- Resolves: rhbz 701038 user shell changed to sbin versus bin
-- Resolves: rhbz 781675 ownership for catalina.out changed from
-- tomcat:tomcat to tomcat:root
+- Resolves: rhbz 781675 ownership for TOMCAT_LOG changed from
+- tomcat:tomcat to root:tomcat
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0:6.0.32-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list