Subject: Re: Improved xendomains script
To: Lubomir Sedlacik <salo@Xtrmntr.org>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: port-xen
Date: 10/17/2005 10:50:36
Lubomir Sedlacik wrote:
> On Mon, Oct 17, 2005 at 09:43:35AM +0000, Johnny C. Lam wrote:
> 
>>	# Start off by running the pre-hook script if it's present.
>>	if [ -n "${xendomains_prehook}" ]; then
>>		cmdline=`printf "${xendomains_prehook}" $domain`
>>		cmd="${cmdline%% *}"
>>		if [ -x "$cmd" ]; then
>>			$cmdline || echo "Pre-hook \`\`$cmdline'' failed... skipping $domain."
>>			continue
>>		fi
>>	fi
>>
>>...
>>
>>	# Finish off by running the post-hook script if it's present.
>>	for domain in $xendomains; do
>>		case "$domain" in
>>		"")	continue ;;
>>		esac
>>		if [ -n "${xendomains_posthook}" ]; then
>>			cmdline=`printf "${xendomains_posthook}" $domain`
>>			cmd="${cmdline%% *}"
>>			if [ -x "$cmd" ]; then
>>				$cmdline || echo "Post-hook \`\`$cmdline'' failed."
>>			fi
>>		fi
>>	done
> 
> 
> is there any reason why you don't use _precmd and _postcmd provided by
> rc.d?

I could definitely just add these bits via /etc/rc.conf.d/xendomains by 
setting start_precmd and stop_postcmd to the above two code blocks, 
respectively.  However, I thought the need to run actions per-domain 
would be common enough amongst Xen users that I didn't want to subject 
them to coming up with the above code blocks on their own.

	Cheers,

	-- Johnny Lam <jlam@pkgsrc.org>