[Pacemaker] Resource Agent Restrictions on opening TCP Connection
Ken Gaillot
kjgaillo at gleim.com
Tue Aug 26 19:31:18 UTC 2014
On 8/26/14 6:32 AM, N, Ravikiran wrote:
> Is there any restrictions on Resource Agent script that it shall not
> support any TCP connection opens.. ??
>
> I have a script as below
>
> executecmd="$FD<>/dev/tcp/localhost/$PORT" #FD
> is the lowest available FD and PORT is hardcoded port
>
> eval "exec $executecmd" 2> /dev/null
>
> retval=$?
>
> echo $retval
> #retval is always 1
> irrespective of the TCP server running on localhost:$PORT
>
> Although I see that I can connect to TCP Server running on
> localhost:$PORT using other scripts with same statements. I cannot
> connect as a ocf-ra.
>
> So, I wanted to know is there any restrictions on my RA script.
Hello Ravikiran,
I can't speak to whether there are limitations on resource agent
scripts, but one gotcha I've seen when using eval/exec is that it will
likely use the system-wide default shell (e.g. /bin/sh) even if the RA
script itself uses a different shell (e.g. /bin/bash). But when running
from the command line under your own user account, it will use your
account's default shell. So you can get different behaviors running
interactively vs called from a daemon.
I'd recommend making sure your exec syntax works in the default system
shell, and if that's not it, try replacing your "2>/dev/null" with
"2>/tmp/ra.err" and see if it's generating any interesting output.
-- Ken Gaillot <kjgaillo at gleim.com>
Gleim NOC
More information about the Pacemaker
mailing list