All of lore.kernel.org
 help / color / mirror / Atom feed
From: mgrac@sourceware.org <mgrac@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager/src/resources apache.sh mysq ...
Date: 29 Sep 2006 11:35:17 -0000	[thread overview]
Message-ID: <20060929113517.9009.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	mgrac at sourceware.org	2006-09-29 11:35:16

Modified files:
	rgmanager/src/resources: apache.sh mysql.sh openldap.sh 
	                         postgres-8.sh samba.sh 
	rgmanager/src/resources/utils: config-utils.sh 

Log message:
	Test if PID file of the application points to running PID. If not then this PID file is deleted and application can start.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/apache.sh.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/mysql.sh.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/openldap.sh.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/postgres-8.sh.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/samba.sh.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/utils/config-utils.sh.diff?cvsroot=cluster&r1=1.3&r2=1.4

--- cluster/rgmanager/src/resources/apache.sh	2006/09/29 10:44:09	1.7
+++ cluster/rgmanager/src/resources/apache.sh	2006/09/29 11:35:16	1.8
@@ -162,8 +162,9 @@
 	clog_service_start $CLOG_INIT	
 
 	create_pid_directory
+	check_pid_file "$APACHE_pid_file"
 
-	if [ -e "$APACHE_pid_file" ]; then
+	if [ $? -ne 0 ]; then
 		clog_check_pid $CLOG_FAILED "$APACHE_pid_file"
 		clog_service_start $CLOG_FAILED
 		return $OCF_ERR_GENERIC
--- cluster/rgmanager/src/resources/mysql.sh	2006/09/29 10:44:09	1.7
+++ cluster/rgmanager/src/resources/mysql.sh	2006/09/29 11:35:16	1.8
@@ -79,8 +79,9 @@
 	clog_service_start $CLOG_INIT
 
 	create_pid_directory
+	check_pid_file "$MYSQL_pid_file"
 
-	if [ -e "$MYSQL_pid_file" ]; then
+	if [ $? -ne 0 ]; then
 		clog_check_pid $CLOG_FAILED "$MYSQL_pid_file"
 		clog_service_start $CLOG_FAILED
 		return $OCF_ERR_GENERIC
--- cluster/rgmanager/src/resources/openldap.sh	2006/09/29 10:44:09	1.5
+++ cluster/rgmanager/src/resources/openldap.sh	2006/09/29 11:35:16	1.6
@@ -127,13 +127,13 @@
 	clog_service_start $CLOG_INIT
 
 	create_pid_directory
+	check_pid_file "$LDAP_pid_file"
 
-	if [ -e "$LDAP_pid_file" ]; then
+	if [ $? -ne 0 ]; then
 		clog_check_pid $CLOG_FAILED "$LDAP_pid_file"
 		clog_service_start $CLOG_FAILED
 		return $OCF_ERR_GENERIC
 	fi
-
 	clog_looking_for $CLOG_INIT "IP Addresses"
 
         ccs_fd=$(ccs_connect);
--- cluster/rgmanager/src/resources/postgres-8.sh	2006/09/29 10:44:09	1.3
+++ cluster/rgmanager/src/resources/postgres-8.sh	2006/09/29 11:35:16	1.4
@@ -120,8 +120,9 @@
 	clog_service_start $CLOG_INIT
 
 	create_pid_directory
+	check_pid_file "$PSQL_pid_file"
 
-	if [ -e "$PSQL_pid_file" ]; then
+	if [ $? -ne 0 ]; then
 		clog_check_pid $CLOG_FAILED "$PSQL_pid_file"
 		clog_service_start $CLOG_FAILED
 		return $OCF_ERR_GENERIC
--- cluster/rgmanager/src/resources/samba.sh	2006/09/29 10:44:09	1.3
+++ cluster/rgmanager/src/resources/samba.sh	2006/09/29 11:35:16	1.4
@@ -110,14 +110,17 @@
 
 	create_pid_directory
 	mkdir -p "$SAMBA_pid_dir"
+	check_pid_file "$SAMBA_smbd_pid_file"
 
-	if [ -e "$SAMBA_smbd_pid_file" ]; then
+	if [ $? -ne 0 ]; then
 		clog_check_pid $CLOG_FAILED "$SAMBA_smbd_pid_file"
 		clog_service_start $CLOG_FAILED
 		return $OCF_ERR_GENERIC
 	fi
 
-	if [ -e "$SAMBA_nmbd_pid_file" ]; then
+	check_pid_file "$SAMBA_nmbd_pid_file"
+
+	if [ $? -ne 0 ]; then
 		clog_check_pid $CLOG_FAILED "$SAMBA_nmbd_pid_file"
 		clog_service_start $CLOG_FAILED
 		return $OCF_ERR_GENERIC
--- cluster/rgmanager/src/resources/utils/config-utils.sh	2006/09/26 23:12:38	1.3
+++ cluster/rgmanager/src/resources/utils/config-utils.sh	2006/09/29 11:35:16	1.4
@@ -252,4 +252,24 @@
 	fi
 
 	return 0;
+}
+
+check_pid_file() {
+	declare pid_file="$1"
+
+	if [ -z "$pid_file" ]; then
+		return 1;
+	fi
+
+	if [ ! -e "$pid_file" ]; then
+		return 0;
+	fi
+
+	if [ ! -d /proc/`cat "$pid_file"` ]; then	
+		rm "$pid_file"
+		ocf_log debug "PID File \"$pid_file\" Was Removed - PID Does Not Exist";
+		return 0;
+	fi
+
+	return 1;
 }
\ No newline at end of file



             reply	other threads:[~2006-09-29 11:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29 11:35 mgrac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-09-26 23:59 [Cluster-devel] cluster/rgmanager/src/resources apache.sh mysq mgrac
2006-09-18 13:48 mgrac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060929113517.9009.qmail@sourceware.org \
    --to=mgrac@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.