[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/rgmanager/src/resources apache.sh mysq ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	mgrac 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]