summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2011-02-03 18:42:02 +0000
committermharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2011-02-03 18:42:02 +0000
commit4621eaf7f389989076d70244217530f1aa8bae5c (patch)
treed23f67fa36b6e8bbfc109667350c5205c611dc79
parent9f679598437b6b0d0e596e377de300f0d75d26d6 (diff)
downloadpki-4621eaf7f389989076d70244217530f1aa8bae5c.tar.gz
pki-4621eaf7f389989076d70244217530f1aa8bae5c.tar.xz
pki-4621eaf7f389989076d70244217530f1aa8bae5c.zip
Bugzilla Bug #674917 - Restore identification of Tomcat-based PKI subsystem
instances git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1816 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
-rw-r--r--pki/base/ca/setup/registry_instance11
-rw-r--r--pki/base/common/scripts/functions47
-rw-r--r--pki/base/kra/setup/registry_instance11
-rw-r--r--pki/base/ocsp/setup/registry_instance11
-rw-r--r--pki/base/tks/setup/registry_instance11
5 files changed, 85 insertions, 6 deletions
diff --git a/pki/base/ca/setup/registry_instance b/pki/base/ca/setup/registry_instance
index 7f0e592a1..3210b9131 100644
--- a/pki/base/ca/setup/registry_instance
+++ b/pki/base/ca/setup/registry_instance
@@ -41,9 +41,18 @@ export TOMCAT_GROUP
PKI_LOCKDIR="/var/lock/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
export PKI_LOCKDIR
-PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}.pid"
+PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}"
export PKI_LOCKFILE
+PKI_PIDDIR="/var/run/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
+export PKI_PIDDIR
+
+PKI_PIDFILE="${PKI_PIDDIR}/${PKI_INSTANCE_ID}.pid"
+export PKI_PIDFILE
+
+TOMCAT_LOCKFILE=/var/lock/subsys/${PKI_INSTANCE_ID}
+export TOMCAT_LOCKFILE
+
TOMCAT_PIDFILE=[TOMCAT_PIDFILE]
export TOMCAT_PIDFILE
diff --git a/pki/base/common/scripts/functions b/pki/base/common/scripts/functions
index 812bc6aee..1fb5e65bb 100644
--- a/pki/base/common/scripts/functions
+++ b/pki/base/common/scripts/functions
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# From "http://fedoraproject.org/wiki/FCNewInit/Initscripts":
#
@@ -728,7 +728,37 @@ start_instance()
# 6 program is not configured
return 6
else
- # 0 success
+ # 0 success
+
+ # Tomcat instances automatically place pid files under
+ # '/var/run' and lock files under '/var/lock/subsys'.
+ #
+ # However, since PKI subsystem instances can have any name,
+ # in order to identify the PKI subsystem type of a particular
+ # PKI instance, we create a separate "pki subsystem identity"
+ # symlink to the PKI instance pid file and place it under
+ # '/var/run/pki/<pki subsystem>', and a separate
+ # "pki subsystem identity" symlink to the PKI instance
+ # lock file and place it under '/var/lock/pki/<pki subsystem>'.
+ #
+ case $PKI_SUBSYSTEM_TYPE in
+ ca|kra|ocsp|tks)
+ if [ -h ${PKI_PIDFILE} ]; then
+ rm -f ${PKI_PIDFILE}
+ fi
+ if [ -f ${TOMCAT_PIDFILE} ]; then
+ ln -s ${TOMCAT_PIDFILE} ${PKI_PIDFILE}
+ chown -h ${TOMCAT_USER}:${TOMCAT_GROUP} ${PKI_PIDFILE}
+ fi
+ if [ -h ${PKI_LOCKFILE} ]; then
+ rm -f ${PKI_LOCKFILE}
+ fi
+ if [ -f ${TOMCAT_LOCKFILE} ]; then
+ ln -s ${TOMCAT_LOCKFILE} ${PKI_LOCKFILE}
+ fi
+ ;;
+ esac
+
return 0
fi
fi
@@ -743,6 +773,19 @@ stop_instance()
$PKI_INSTANCE_INITSCRIPT stop
rv=$?
+ # On Tomcat subsystems, always remove the "pki subsystem identity" symlinks
+ # that were previously associated with the Tomcat 'pid' and 'lock' files.
+ case $PKI_SUBSYSTEM_TYPE in
+ ca|kra|ocsp|tks)
+ if [ -h ${PKI_PIDFILE} ]; then
+ rm -f ${PKI_PIDFILE}
+ fi
+ if [ -h ${PKI_LOCKFILE} ]; then
+ rm -f ${PKI_LOCKFILE}
+ fi
+ ;;
+ esac
+
return $rv
}
diff --git a/pki/base/kra/setup/registry_instance b/pki/base/kra/setup/registry_instance
index 7f0e592a1..3210b9131 100644
--- a/pki/base/kra/setup/registry_instance
+++ b/pki/base/kra/setup/registry_instance
@@ -41,9 +41,18 @@ export TOMCAT_GROUP
PKI_LOCKDIR="/var/lock/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
export PKI_LOCKDIR
-PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}.pid"
+PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}"
export PKI_LOCKFILE
+PKI_PIDDIR="/var/run/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
+export PKI_PIDDIR
+
+PKI_PIDFILE="${PKI_PIDDIR}/${PKI_INSTANCE_ID}.pid"
+export PKI_PIDFILE
+
+TOMCAT_LOCKFILE=/var/lock/subsys/${PKI_INSTANCE_ID}
+export TOMCAT_LOCKFILE
+
TOMCAT_PIDFILE=[TOMCAT_PIDFILE]
export TOMCAT_PIDFILE
diff --git a/pki/base/ocsp/setup/registry_instance b/pki/base/ocsp/setup/registry_instance
index 7f0e592a1..3210b9131 100644
--- a/pki/base/ocsp/setup/registry_instance
+++ b/pki/base/ocsp/setup/registry_instance
@@ -41,9 +41,18 @@ export TOMCAT_GROUP
PKI_LOCKDIR="/var/lock/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
export PKI_LOCKDIR
-PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}.pid"
+PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}"
export PKI_LOCKFILE
+PKI_PIDDIR="/var/run/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
+export PKI_PIDDIR
+
+PKI_PIDFILE="${PKI_PIDDIR}/${PKI_INSTANCE_ID}.pid"
+export PKI_PIDFILE
+
+TOMCAT_LOCKFILE=/var/lock/subsys/${PKI_INSTANCE_ID}
+export TOMCAT_LOCKFILE
+
TOMCAT_PIDFILE=[TOMCAT_PIDFILE]
export TOMCAT_PIDFILE
diff --git a/pki/base/tks/setup/registry_instance b/pki/base/tks/setup/registry_instance
index 7f0e592a1..3210b9131 100644
--- a/pki/base/tks/setup/registry_instance
+++ b/pki/base/tks/setup/registry_instance
@@ -41,9 +41,18 @@ export TOMCAT_GROUP
PKI_LOCKDIR="/var/lock/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
export PKI_LOCKDIR
-PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}.pid"
+PKI_LOCKFILE="${PKI_LOCKDIR}/${PKI_INSTANCE_ID}"
export PKI_LOCKFILE
+PKI_PIDDIR="/var/run/${PKI_FLAVOR}/${PKI_SUBSYSTEM_TYPE}"
+export PKI_PIDDIR
+
+PKI_PIDFILE="${PKI_PIDDIR}/${PKI_INSTANCE_ID}.pid"
+export PKI_PIDFILE
+
+TOMCAT_LOCKFILE=/var/lock/subsys/${PKI_INSTANCE_ID}
+export TOMCAT_LOCKFILE
+
TOMCAT_PIDFILE=[TOMCAT_PIDFILE]
export TOMCAT_PIDFILE