Hi Dominik,

On Mon, Jun 23, 2008 at 03:15:26PM +0200, Dominik Klein wrote:
> Here's the next version. The start cmd might look a little scary (to me at 
> least), but now it starts the cmd without leaving the actual "su" command 
> around.

and a few more comments, this time in a form of a patch.

Cheers,

Dejan
--- /tmp/anything.orig	2008-06-23 15:24:47.000000000 +0200
+++ /tmp/anything	2008-06-23 16:07:24.000000000 +0200
@@ -105,6 +105,7 @@
 		# one last attempt with sigkill
 		ocf_log warn "Stop $process: $process could not be stopped by SIGTERM, now sending SIGKILL."
 		kill -9 $pid
+		sleep 1
 		if ! anything_status
 		then
 			ocf_log debug "Stop $process: SIGKILL did the job."
@@ -115,7 +116,7 @@
 		fi
 	else
 		# was not running, so stop can be considered successful
-		rm -f $pidfile > /dev/null 2>&1
+		rm -f $pidfile # 'rm -f' doesn't produce any output, unless there's a real problem
 		return $OCF_SUCCESS
 	fi
 	return $OCF_ERR_GENERIC
@@ -163,20 +164,21 @@
 	then
 		exit $OCF_ERR_INSTALLED
 	fi
+	# this is probably bash specific, better use >/dev/null 2>&1
+	# also, getent(1) should be preferred to id(1), it's more
+	# straightforward here (i.e. getent passwd $user >/dev/null)
 	if ! id $user &>/dev/null
 	then
 		exit $OCF_ERR_INSTALLED
 	fi
+	# better to "mkdir -p `dirname $filename`"
+	# instead of bailing out
 	for filename in "$logfile" "$errlogfile"
 	do
-		if [ -n "$filename" ]
-		then
-			if [ ! -d "$(dirname $filename)" ]
-			then
-				ocf_log err "$(dirname $filename) for $filename does not exist! Please create it."
-				exit $OCF_ERR_INSTALLED
-			fi
-		fi
+		mkdir -p `dirname $filename` || {
+			ocf_log err "cannot create $(dirname $filename)"
+			exit $OCF_ERR_INSTALLED
+		}
 	done
 	return $OCF_SUCCESS
 }
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to