Skip to contentSkip to conversation

crm-fence-peer.sh missing shell expansion

Drbd-dev Justin Pryzby 2 participants 3 messages May 8, 2015 DRBD driver

lore
Share & tools
lore
#0 lore raw

There are several instances of unexpanded variables in here:

                sleep $(( net_hickup_time - SECONDS ))
        reboot_timeout=$(( reboot_timeout + SECONDS ))
                echo WARNING "${extra_msg}going to reboot -f in $(( reboot_timeout - SECONDS )) seconds! To cancel: kill $$"
                        if out=$( crmadmin -t $(( cibtimeout * 200 )) -S $DRBD_PEER ) \
#1 lore raw
Quoted 6 lines · Justin Pryzby

There are several instances of unexpanded variables in here:

                sleep $(( net_hickup_time - SECONDS ))
        reboot_timeout=$(( reboot_timeout + SECONDS ))
                echo WARNING "${extra_msg}going to reboot -f in $(( reboot_timeout - SECONDS )) seconds! To cancel: kill $$"
                        if out=$( crmadmin -t $(( cibtimeout * 200 )) -S $DRBD_PEER ) \

Could you be a bit more precise where you _exactly_ see the problem, please? "Several" does not help a bash n00b like me. Do you mean the '$' is missing for example for 'SECONDS'?

If so, that isn't a problem:
----------8<----------8<----------
#!/bin/bash

FOO=42
BAR=23

echo $(( FOO - BAR ))
----------8<----------8<----------

Which will echo 19...

Regards, rck

#2 lore raw
Quoted 11 lines · Roland Kammerer
Quoted 6 lines · Justin Pryzby

There are several instances of unexpanded variables in here:

                sleep $(( net_hickup_time - SECONDS ))
        reboot_timeout=$(( reboot_timeout + SECONDS ))
                echo WARNING "${extra_msg}going to reboot -f in $(( reboot_timeout - SECONDS )) seconds! To cancel: kill $$"
                        if out=$( crmadmin -t $(( cibtimeout * 200 )) -S $DRBD_PEER ) \

Could you be a bit more precise where you _exactly_ see the problem, please? "Several" does not help a bash n00b like me. Do you mean the '$' is missing for example for 'SECONDS'?

Yes, I was referring to that .. but, oh my goodness, you're right ..

Sorry for noise and thanks for the lesson :)

Justin