varname=`echo $v | cut -d= -f1`
value=`echo $v | cut -d= -f2`
ctdb setvar $varname $value || exit 1
- echo "`date` Set $varname to $value"
+ echo "Set $varname to $value"
done || exit 1
;;
}
[ ! -f "$CTDB_PUBLIC_ADDRESSES" ] && {
- echo "`date` No public addresses file found. Nothing to do for 10.interfaces"
+ echo "No public addresses file found. Nothing to do for 10.interfaces"
exit 0
}
[ -z "$_IP_HELD" ] || {
_IFACE=`echo $_IP_HELD | sed -e "s/.*\s//"`
_NM=`echo $_IP_HELD | sed -e "s/.*$_IP\///" -e "s/\s.*//"`
- echo "`date` Removing public address $_IP/$_NM from device $_IFACE"
+ echo "Removing public address $_IP/$_NM from device $_IFACE"
/sbin/ip addr del $_IP/$_NM dev $_IFACE
}
done
# called when ctdbd wants to claim an IP address
takeip)
if [ $# != 3 ]; then
- echo "`date` must supply interface, IP and maskbits"
+ echo "must supply interface, IP and maskbits"
exit 1
fi
iface=$1
# we make sure the interface is up first
/sbin/ip link set $iface up || {
- echo "`/bin/date` Failed to bringup interface $iface"
+ echo "Failed to bringup interface $iface"
exit 1
}
/sbin/ip addr add $ip/$maskbits dev $iface || {
- echo "`/bin/date` Failed to add $ip/$maskbits on dev $iface"
+ echo "Failed to add $ip/$maskbits on dev $iface"
exit 1
}
# cope with the script being killed while we have the interface blocked
# called when ctdbd wants to release an IP address
releaseip)
if [ $# != 3 ]; then
- echo "`/bin/date` must supply interface, IP and maskbits"
+ echo "must supply interface, IP and maskbits"
exit 1
fi
[ -z "$secondaries" ] || {
for i in $secondaries; do
if /sbin/ip addr list dev $iface | grep "inet $i" > /dev/null; then
- echo "`date` kept secondary $i on dev $iface"
+ echo "kept secondary $i on dev $iface"
else
- echo "`date` re-adding secondary address $i to dev $iface"
+ echo "re-adding secondary address $i to dev $iface"
/sbin/ip addr add $i dev $iface || failed=1
fi
done
}
/sbin/iptables -D INPUT -i $iface -d $ip -j DROP
[ $failed = 0 ] || {
- echo "`/bin/date` Failed to del $ip on dev $iface"
+ echo "Failed to del $ip on dev $iface"
exit 1
}
for IFACE in $INTERFACES ; do
if [ `echo $IFACE | grep '^bond*'` ] ; then
grep '^MII Status: up' /proc/net/bonding/$IFACE > /dev/null || {
- echo "`date` ERROR: public network interface $IFACE is down"
+ echo "ERROR: public network interface $IFACE is down"
exit 1
}
else
[ -z "$IFACE" ] || {
/usr/sbin/ethtool $IFACE | grep 'Link detected: yes' > /dev/null || {
- echo "`date` ERROR: No link on the public network interface $IFACE"
+ echo "ERROR: No link on the public network interface $IFACE"
exit 1
}
}
periodic_cleanup() {
# running smbstatus scrubs any dead entries from the connections
# and sessionid database
- echo "`date` Running periodic cleanup of samba databases"
+ echo "Running periodic cleanup of samba databases"
smbstatus -n > /dev/null 2>&1 &
}
}
testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && {
- echo "`date` ERROR: testparm shows smb.conf is not clean"
+ echo "ERROR: testparm shows smb.conf is not clean"
exit 1
}
# mount needs special handling since it is sometimes not started
# correctly on RHEL5
rpcinfo -u localhost 100005 1 > /dev/null || {
- echo "`date` ERROR: MOUNTD is not running. Trying to restart it."
+ echo "ERROR: MOUNTD is not running. Trying to restart it."
RPCMOUNTDOPTS=""
[ -n "$MOUNTD_PORT" ] && RPCMOUNTDOPTS="$RPCMOUNTDOPTS -p $MOUNTD_PORT"
killall -q -9 rpc.mountd
dip=`echo $dest | cut -d: -f1`
dport=`echo $dest | cut -d: -f2`
# send three, in case of lost packets
- echo "`date` Sending NFS tickle ack for $ip to $dip:$dport"
+ echo "Sending NFS tickle ack for $ip to $dip:$dport"
for i in `seq 1 3`; do
ctdb tickle $dip:$dport $ip:2049
done
wait_cmd="$2"
[ -z "$wait_cmd" ] && return;
all_ok=0
- echo "`/bin/date` Waiting for service $service_name to start"
+ echo "Waiting for service $service_name to start"
while [ $all_ok -eq 0 ]; do
$wait_cmd > /dev/null 2>&1 && all_ok=1
ctdb status > /dev/null 2>&1 || {
}
[ $all_ok -eq 1 ] || sleep 1
done
- echo "`/bin/date` Local service $service_name is up"
+ echo "Local service $service_name is up"
}
wait_ports="$*"
[ -z "$wait_ports" ] && return;
all_ok=0
- echo "`/bin/date` Waiting for tcp service $service_name to start"
+ echo "Waiting for tcp service $service_name to start"
while [ $all_ok -eq 0 ]; do
all_ok=1
for p in $wait_ports; do
elif [ -x /usr/bin/netstat ]; then
(/usr/bin/netstat -a -n | egrep "0.0.0.0:$p\s*LISTEN" > /dev/null) || all_ok=0
else
- echo "`date` - No tool to check tcp ports availabe. can not check in ctdb_wait_tcp_ports"
+ echo "No tool to check tcp ports availabe. can not check in ctdb_wait_tcp_ports"
return
fi
done
exit 1
}
done
- echo "`/bin/date` Local tcp services for $service_name are up"
+ echo "Local tcp services for $service_name are up"
}
wait_dirs="$*"
[ -z "$wait_dirs" ] && return;
all_ok=0
- echo "`/bin/date` Waiting for local directories for $service_name"
+ echo "Waiting for local directories for $service_name"
while [ $all_ok -eq 0 ]; do
all_ok=1
for d in $wait_dirs; do
exit 1
}
done
- echo "`/bin/date` Local directories for $service_name are available"
+ echo "Local directories for $service_name are available"
}
prognum="$2"
version="$3"
rpcinfo -u localhost $prognum $version > /dev/null || {
- echo "`date` ERROR: $service_name not responding to rpc requests"
+ echo "ERROR: $service_name not responding to rpc requests"
exit 1
}
}
[ -z "$wait_dirs" ] && return;
for d in $wait_dirs; do
[ -d $d ] || {
- echo "`date` ERROR: $service_name directory $d not available"
+ echo "ERROR: $service_name directory $d not available"
exit 1
}
done
(/usr/bin/netstat -a -n | egrep "0.0.0.0:$p .*LISTEN" > /dev/null ) || all_ok=0
fi
[ $all_ok -eq 1 ] || {
- echo "`date` ERROR: $service_name tcp port $p is not responding"
+ echo "ERROR: $service_name tcp port $p is not responding"
exit 1
}
done
wait_cmd="$2"
[ -z "$wait_cmd" ] && return;
$wait_cmd > /dev/null 2>&1 || {
- echo "`date` ERROR: $service_name - $wait_cmd returned error"
+ echo "ERROR: $service_name - $wait_cmd returned error"
exit 1
}
}
destip=`echo $dest | cut -d: -f1`
destport=`echo $dest | cut -d: -f2`
ctdb killtcp $srcip:$srcport $destip:$destport >/dev/null 2>&1 || _failed=1
- echo "`date` Killing TCP connection $srcip:$srcport $destip:$destport"
+ echo "Killing TCP connection $srcip:$srcport $destip:$destport"
_killcount=`expr $_killcount + 1`
done < $connfile
/bin/rm -f $connfile
[ $_failed = 0 ] || {
- echo "`date` Failed to send killtcp control"
+ echo "Failed to send killtcp control"
return;
}
[ $_killcount -gt 0 ] || {
sleep 1
_count=`expr $_count + 1`
[ $_count -gt 3 ] && {
- echo "`date` Timed out killing tcp connections for IP $_IP"
+ echo "Timed out killing tcp connections for IP $_IP"
return;
}
done
- echo "`date` killed $_killcount TCP connections to released IP $_IP"
+ echo "killed $_killcount TCP connections to released IP $_IP"
}