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

[Cluster-devel] [PATCH] Fix apache resource script




Hi guys,

first bit allows to run the resource on Debian/Ubuntu systems without manual patching, by checking for the apache2 daemon if httpd is not available.

second bit makes that piece of code to work. For some reasons the sintax =~ '^/' doesn't work in recent bash. Replace with something more generic and less bash dependent.

third bit: not all versions of grep are built with perl regexp support. For this specific instance, there is no point to use -P. Use -E that achieve the same result and avoid warnings.

Please apply or ACK.

Thanks
Fabio

PS I am investigating a more deep rewrite of this script as it is buggy in several different ways... is the original author still working on it or interested in working with me?

Index: apache.sh
===================================================================
RCS file: /cvs/cluster/cluster/rgmanager/src/resources/apache.sh,v
retrieving revision 1.10
diff -u -r1.10 apache.sh
--- apache.sh	5 Apr 2007 15:08:19 -0000	1.10
+++ apache.sh	10 Jan 2008 10:06:20 -0000
@@ -32,7 +32,11 @@
 . $(dirname $0)/utils/messages.sh
 . $(dirname $0)/utils/ra-skelet.sh

-declare APACHE_HTTPD=/usr/sbin/httpd
+if [ -x /usr/sbin/httpd ]; then
+	declare APACHE_HTTPD=/usr/sbin/httpd
+elif [ -x /usr/sbin/apache2 ]; then
+	declare APACHE_HTTPD=/usr/sbin/apache2
+fi
 declare APACHE_serverConfigFile
 declare APACHE_pid_file="`generate_name_for_pid_file`"
 declare APACHE_conf_dir="`generate_name_for_conf_dir`"
@@ -42,7 +46,7 @@

 apache_serverConfigFile()
 {
-	if [[ "$OCF_RESKEY_config_file" =~ '^/' ]]; then
+	if $(echo $OCF_RESKEY_config_file | grep -q "^/"); then
 		APACHE_serverConfigFile="$OCF_RESKEY_config_file"
 	else
 		APACHE_serverConfigFile="$OCF_RESKEY_server_root/$OCF_RESKEY_config_file"
@@ -135,7 +139,7 @@

 	IFS_old="$IFS"
 	IFS=$'\n'
- for i in `"$APACHE_parseConfig" -D"$OCF_RESKEY_name" < "$originalConfigFile" | grep -P '(^Listen)|(^Port)' | grep -v ':'`; do + for i in `"$APACHE_parseConfig" -D"$OCF_RESKEY_name" < "$originalConfigFile" | grep -E '(^Listen)|(^Port)' | grep -v ':'`; do
 		port=`echo $i | sed 's/^Listen \(.*\)/\1/;s/^Port \(.*\)/\1/'`;
 		IFS=$' ';
 		for z in $ip_addresses; do


--
I'm going to make him an offer he can't refuse.


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