Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
On Mon, Nov 28, 2011 at 03:57:19PM +0100, Ulrich Windl wrote: Florian Haas flor...@hastexo.com schrieb am 28.11.2011 um 15:05 in Nachricht capuexz9bm3suof0fteqvbjcpyo9rlz9gazk3mc5td8oyosi...@mail.gmail.com: On Mon, Nov 28, 2011 at 2:58 PM, Dejan Muhamedagic deja...@fastmail.fm wrote: Why? It seems typeset is the POSIX thing, while local is a BASH-ism. So what's wrong with local variables? local is almost certainly not a bashism. At least I can recall once changing typeset to local in some RA. IIRC, then local foo=bar is a bashism, whereas local foo; foo=bar is POSIX compliant. At least that's what checkbashisms seems to indicate. Hmmm: HP-UX POSIX Shell uses typeset -i e=0, and I always thought that's just POSIX. AFAIK, neither typeset nor declare nor local is POSIX (yet) (that should be true for about half a year ago, at least). thers is indeed talk to make this POSIX, possibly indeed standardized on the name typeset. Yes, well, kornshell knows about typeset, and does not know declare nor local (or has that changed?). But ksh is rarely used as /bin/sh. Bash knows about all three, but deprecates typeset in favor of declare, where both are synonyms in the internal implementation. Besides, what we care for here is not what is written in some standard (yet to come), but the real world, and that real world looks like this: dash -c 'typeset X=1 ; echo $X' dash: typeset: not found dash -c 'declare X=1 ; echo $X' dash: declare: not found dash -c 'local X=1 ; echo $X' 1 Where dash is the only relevant thing frequently used as /bin/sh again: afaik. So as long as you keep the agent #!/bin/sh, make sure it works with dash. -- : Lars Ellenberg : LINBIT | Your Way to High Availability : DRBD/HA support and consulting http://www.linbit.com ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
On Mon, Nov 28, 2011 at 8:51 AM, Ulrich Windl ulrich.wi...@rz.uni-regensburg.de wrote: Florian Haas florian.h...@hastexo.com schrieb am 25.11.2011 um 14:35 in Nachricht 4ecf99ae.8050...@hastexo.com: [...] ... and I just morphed that patch into a git branch. Ulrich, as much as we're all grateful for contributions to resource agents, _please_ don't mix functional modification with cleanup such as whitespace modifications. It makes the review awfully tedious. I know, but inconsistend indentation should have been fixed before releasing. Anyway, did you try option -b or -w? :) Sending a uuencoded everything-rolled-into-one patch and then starting about what others should fix before releasing is a great example of self-ironic humor. I like that. Thanks! Made my day. Florian -- Need help with High Availability? http://www.hastexo.com/now ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
Hi, On Mon, Nov 28, 2011 at 02:41:42PM +0100, Florian Haas wrote: On Mon, Nov 28, 2011 at 8:51 AM, Ulrich Windl ulrich.wi...@rz.uni-regensburg.de wrote: Florian Haas florian.h...@hastexo.com schrieb am 25.11.2011 um 14:35 in Nachricht 4ecf99ae.8050...@hastexo.com: [...] ... and I just morphed that patch into a git branch. Ulrich, as much as we're all grateful for contributions to resource agents, _please_ don't mix functional modification with cleanup such as whitespace modifications. It makes the review awfully tedious. I know, but inconsistend indentation should have been fixed before releasing. Anyway, did you try option -b or -w? :) Sending a uuencoded everything-rolled-into-one patch and then starting I don't really mind about it being uuencoded, but indeed this is a complete RA rewrite which can make reviewing a tad tedious. Any takers? about what others should fix before releasing is a great example of self-ironic humor. I like that. Thanks! Made my day. :) Cheers, Dejan Florian -- Need help with High Availability? http://www.hastexo.com/now ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
Hi, On Mon, Nov 28, 2011 at 08:38:11AM +0100, Ulrich Windl wrote: Lars Ellenberg lars.ellenb...@linbit.com schrieb am 25.11.2011 um 13:18 in Nachricht 2025121816.GB7722@barkeeper1-xen.linbit: On Tue, Nov 22, 2011 at 12:09:51PM +0100, Ulrich Windl wrote: Dejan Muhamedagic deja...@fastmail.fm schrieb am 21.11.2011 um 16:11 in Nachricht 2021151134.GB3600@squib: [...] This RA could certainly be improved. Patches welcome! OK, I tried a little, removing a lot. IMHO the new version is better than the previous one, but scores may vary. Anyway, you'll hate me for the patch format, but I have no mail where I develop, so I used just copypaste... Don't use typeset ;-) Why? It seems typeset is the POSIX thing, while local is a BASH-ism. So what's wrong with local variables? local is almost certainly not a bashism. At least I can recall once changing typeset to local in some RA. Cheers, Dejan Other than that, I don't have feedback atm. Regards, Ulrich ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
On Mon, Nov 28, 2011 at 2:58 PM, Dejan Muhamedagic deja...@fastmail.fm wrote: Why? It seems typeset is the POSIX thing, while local is a BASH-ism. So what's wrong with local variables? local is almost certainly not a bashism. At least I can recall once changing typeset to local in some RA. IIRC, then local foo=bar is a bashism, whereas local foo; foo=bar is POSIX compliant. At least that's what checkbashisms seems to indicate. Cheers, Florian -- Need help with High Availability? http://www.hastexo.com/now ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
Florian Haas flor...@hastexo.com schrieb am 28.11.2011 um 14:41 in Nachricht CAPUexz9y557445CW=elti2qyx9ggxmfp8q5wxsjiad5i4oc...@mail.gmail.com: On Mon, Nov 28, 2011 at 8:51 AM, Ulrich Windl ulrich.wi...@rz.uni-regensburg.de wrote: Florian Haas florian.h...@hastexo.com schrieb am 25.11.2011 um 14:35 in Nachricht 4ecf99ae.8050...@hastexo.com: [...] ... and I just morphed that patch into a git branch. Ulrich, as much as we're all grateful for contributions to resource agents, _please_ don't mix functional modification with cleanup such as whitespace modifications. It makes the review awfully tedious. I know, but inconsistend indentation should have been fixed before releasing. Anyway, did you try option -b or -w? :) Sending a uuencoded everything-rolled-into-one patch and then starting about what others should fix before releasing is a great example of self-ironic humor. I like that. Thanks! Made my day. Hi! I believe that bad code is still bad code even if nicely packaged, just as good code is good code, especially when transported binary-safe over E-Mail. I really don't see why anybody working with a UNIX system cannot uudecode the code. Even vi can do it. At least you had your fun. Regards, Ulrich ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
Florian Haas flor...@hastexo.com schrieb am 28.11.2011 um 15:05 in Nachricht capuexz9bm3suof0fteqvbjcpyo9rlz9gazk3mc5td8oyosi...@mail.gmail.com: On Mon, Nov 28, 2011 at 2:58 PM, Dejan Muhamedagic deja...@fastmail.fm wrote: Why? It seems typeset is the POSIX thing, while local is a BASH-ism. So what's wrong with local variables? local is almost certainly not a bashism. At least I can recall once changing typeset to local in some RA. IIRC, then local foo=bar is a bashism, whereas local foo; foo=bar is POSIX compliant. At least that's what checkbashisms seems to indicate. Hmmm: HP-UX POSIX Shell uses typeset -i e=0, and I always thought that's just POSIX. Ulrich ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
Lars Ellenberg lars.ellenb...@linbit.com schrieb am 25.11.2011 um 13:18 in Nachricht 2025121816.GB7722@barkeeper1-xen.linbit: On Tue, Nov 22, 2011 at 12:09:51PM +0100, Ulrich Windl wrote: Dejan Muhamedagic deja...@fastmail.fm schrieb am 21.11.2011 um 16:11 in Nachricht 2021151134.GB3600@squib: [...] This RA could certainly be improved. Patches welcome! OK, I tried a little, removing a lot. IMHO the new version is better than the previous one, but scores may vary. Anyway, you'll hate me for the patch format, but I have no mail where I develop, so I used just copypaste... Don't use typeset ;-) Why? It seems typeset is the POSIX thing, while local is a BASH-ism. So what's wrong with local variables? Other than that, I don't have feedback atm. Regards, Ulrich ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
Florian Haas florian.h...@hastexo.com schrieb am 25.11.2011 um 14:35 in Nachricht 4ecf99ae.8050...@hastexo.com: [...] ... and I just morphed that patch into a git branch. Ulrich, as much as we're all grateful for contributions to resource agents, _please_ don't mix functional modification with cleanup such as whitespace modifications. It makes the review awfully tedious. I know, but inconsistend indentation should have been fixed before releasing. Anyway, did you try option -b or -w? I've now _tried_ to fix up this patch into reasonably logical chunks, and pushed it to the xinetd branch in my github repo. This doesn't mean I'm endorsing or sponsoring the patch, just trying to make it easier for others to review. I know it's not perfect, but it's closer on how it should be IMHO. Regards, Ulrich The commit history (on top of the upstream master branch) is here: https://github.com/fghaas/resource-agents/compare/master...xinetd Cheers, Florian ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
On Tue, Nov 22, 2011 at 12:09:51PM +0100, Ulrich Windl wrote: Dejan Muhamedagic deja...@fastmail.fm schrieb am 21.11.2011 um 16:11 in Nachricht 2021151134.GB3600@squib: [...] This RA could certainly be improved. Patches welcome! OK, I tried a little, removing a lot. IMHO the new version is better than the previous one, but scores may vary. Anyway, you'll hate me for the patch format, but I have no mail where I develop, so I used just copypaste... Don't use typeset ;-) Other than that, I don't have feedback atm. But I decoded and inlined your patch below, that should encourage feedback by others, hopefully. Lars From 2bfd79b8840fe260369773e217712934c605460d Mon Sep 17 00:00:00 2001 From: Ulrich Windl ulrich.wi...@rz.uni-regensburg.de Date: Tue, 22 Nov 2011 11:54:12 +0100 Subject: [PATCH] Reimplemented the service check and manipulation Removed most of the strange checking of the service, and use real checking of the disable directive in the service definition file. Now it's required to have a disable=yes|no in the service definition file. Improved descriptions in XML metadata. Improved log messages. Improved indentation. --- Xinetd | 472 ++-- 1 files changed, 101 insertions(+), 371 deletions(-) diff --git a/Xinetd b/Xinetd index bf68240..40f5bef 100755 --- a/Xinetd +++ b/Xinetd @@ -3,8 +3,9 @@ # Startup/shutdown script for services managed by xinetd. # # Copyright (C) 2003 Charlie Brooks +# Copyright (C) 2011 Ulrich Windl # -# WARNING: Tested ONLY on Red Hat 7.3 and Fedora Core 2/4 at this time. +# WARNING: Tested ONLY on SLES11 SP1 at this time. # # Author: Charlie Brooks h...@hbcs.org # Description: given parameters of a service name and start|stop|status, @@ -22,6 +23,9 @@ : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat} . ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs +service=$OCF_RESKEY_service +SVCDEF=/etc/xinetd.d/$service + ### meta_data() { @@ -33,22 +37,27 @@ meta_data() { longdesc lang=en Resource script for Xinetd. It starts/stops services managed -by xinetd. +by xinetd by enabling or disabling them in the configuration file. + +Important notes: -Note that the xinetd daemon itself must be running: we are not -going to start it or stop it ourselves. +The xinetd daemon itself must be running: we are not going to start or +stop it ourselves. + +All services should have a line saying either disable=yes or disable=no. +The script just changes those settings before reloading xinetd. Important: in case the services managed by the cluster are the only ones enabled, you should specify the -stayalive option for xinetd or it will exit on Heartbeat stop. Alternatively, you may enable some internal service such as echo. /longdesc -shortdesc lang=enManages an Xinetd service/shortdesc +shortdesc lang=enManages a service of Xinetd/shortdesc parameters parameter name=service unique=0 required=1 longdesc lang=en -The service name managed by xinetd. +The name of the service managed by xinetd. /longdesc shortdesc lang=enservice name/shortdesc content type=string default= / @@ -68,400 +77,122 @@ The service name managed by xinetd. END } -# don't rely on the pid file, but lookup xinetd in the list of -# processes - +# force xinetd to reload the service descriptions hup_inetd () { -pid=`ps -e -o pid,command | grep '/[x]inetd' | awk '{print $1}'` +# don't rely on the pid file, but lookup xinetd in the list of +# processes +pid=`ps -e -o pid,command | $AWK '$2 ~ /\/[x]inetd/ { print $1 }'` if [ $pid ]; then - if kill -s HUP $pid; then - : - else - ocf_log err Could not SigHUP xinetd superdaemon! - ocf_log err perhaps we are booting after a system crash - exit $OCF_ERR_GENERIC - fi + if kill -s HUP $pid; then +ocf_log info Asked xinetd to reload by sending SIGHUP to PID $pid! + else +ocf_log err Failed to send SIGHUP to xinetd PID $pid! +exit $OCF_ERR_GENERIC + fi else - ocf_log err xinetd superdaemon process not found! - ocf_log err perhaps we are currently booting the system. - exit $OCF_ERR_GENERIC + ocf_log err PID of xinetd not found! + exit $OCF_ERR_GENERIC fi } -xup_start () { - if [ running = `xup_status` ]; then -ocf_log info Service $service already started -exit $OCF_SUCCESS - fi - - ocf_log info $0: enabling in $RCFILE - if $AWK '!/disable/' $RCFILE $RCFILE.xup -then - if mv $RCFILE.xup $RCFILE -then - ocf_log info $0: Starting - hup_inetd - touch $PIDFILE -else - ocf_log err Could not replace $RCFILE - fi -else - ocf_log err Could not rewrite $RCFILE! - fi +# check disable = X, printing X +check_service() +{ +ocf_log info
Re: [Linux-HA] Antw: Re: ocf_heartbeat:Xinetd: bad status report
On 11/25/11 13:18, Lars Ellenberg wrote: On Tue, Nov 22, 2011 at 12:09:51PM +0100, Ulrich Windl wrote: Dejan Muhamedagic deja...@fastmail.fm schrieb am 21.11.2011 um 16:11 in Nachricht 2021151134.GB3600@squib: [...] This RA could certainly be improved. Patches welcome! OK, I tried a little, removing a lot. IMHO the new version is better than the previous one, but scores may vary. Anyway, you'll hate me for the patch format, but I have no mail where I develop, so I used just copypaste... Don't use typeset ;-) Other than that, I don't have feedback atm. But I decoded and inlined your patch below, that should encourage feedback by others, hopefully. Lars ... and I just morphed that patch into a git branch. Ulrich, as much as we're all grateful for contributions to resource agents, _please_ don't mix functional modification with cleanup such as whitespace modifications. It makes the review awfully tedious. I've now _tried_ to fix up this patch into reasonably logical chunks, and pushed it to the xinetd branch in my github repo. This doesn't mean I'm endorsing or sponsoring the patch, just trying to make it easier for others to review. The commit history (on top of the upstream master branch) is here: https://github.com/fghaas/resource-agents/compare/master...xinetd Cheers, Florian signature.asc Description: OpenPGP digital signature ___ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems