On 2008-02-08T10:50:31, Eddie C <[EMAIL PROTECTED]> wrote:
> pen 8080 host1:80 host2:80
>
> This makes it ideal work as an RA, because the load balancer (ok its a
> proxy but close enough) can fail over to any node without having to
> worry about synchronizing configuration files.
You could do something very similar with LVS as well, btw. No need for
any daemon.
> #!/bin/sh
> # Edward Guy Capriolo
> # Pen RA: Used to start the pen proxy from linux HA
> #
> # OCF parameters are as below
This lacks a GPL-license header, and I'd recommend to add one saying to
use GPLv2 or v3.
> pen_stop() {
> WS_PID=`ps -ef | grep /usr/bin/pen | grep $OCF_RESKEY_control_port |
> grep -v grep | awk '{print $2}'`
> if [ "$WS_PID" = "" ] ; then
> echo "pen is already stopped"
> return $OCF_SUCCESS
> else
> kill $WS_PID
> echo "pen stopped [OK]"
> return $OCF_SUCCESS
> fi
>
> exit $OCF_SUCCESS
> }
Code like that always makes me a big worried ;-) The last exit statement
can never be reached.
> pen_monitor() {
> WS_PID=`ps -ef | grep /usr/bin/pen | grep $OCF_RESKEY_control_port |
> grep -v grep | awk '{print $2}'`
> if [ "$WS_PID" = "" ] ; then
> return $OCF_NOT_RUNNING
> else
> return $OCF_SUCCESS
> fi
>
> return $OCF_ERR_GENERIC
> }
Same here. The error test code should probably be done separately - if
it is running, check it.
(The WS_PID search also seems like something which would benefit from
being put into a function so you don't have to repeat it. Chaing grep
with awk also fails to use awk and is needlessly complicated.)
Regards,
Lars
--
Teamlead Kernel, SuSE Labs, Research and Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems