[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-ha-dev
Subject: [Linux-ha-dev] Building on multiple machines
From: Andrew Beekhof <lists () beekhof ! net>
Date: 2004-09-28 12:17:26
Message-ID: 5BF54BE8-1148-11D9-89C2-000A95B71D78 () beekhof ! net
[Download RAW message or body]
I know most people out there are RPM junkies, but for those that arent,
these bash functions might come in handy. I like it because it doesnt
compile from scratch each time - your needs may differ.
Basic prerequisites are:
- an rsync target called "ha" where you build the sources on each
machine
- ssh access to all the boxes
- workspaces under $devel_home
- a linux-ha-config under $devel_home containing any files you want
pushed to /etc/ha.d (i push authkeys, ha.cf and haresources)
Andrew
export devel_home=~/Development
export default_ha_target=linux-ha-b1
function hainst() {
do_clean=0
do_config=0
target=$default_ha_target
done=0
prompt_me=0
while test "$done" = "0"; do
case "$1" in
-t) target=$2; shift; shift;;
-c) do_clean=$2; shift; shift;;
-p) prompt_me=1; shift;;
-C) do_config=$2; shift; shift;;
"") done=1;;
*) echo "unknown option: $1"; return 1;;
esac
done
all_hosts="fish chips mayo"
for ha_host in $all_hosts; do
inst-to -h $ha_host -c $do_clean -C $do_config
if [ $prompt_me = 1 ]; then
echo Press any key to continue...
read
# only wait once, after that its sure to complete
prompt_me=0
else
sleep 5
fi
done
}
function inst-to() {
do_clean=0
do_config=0
target=$default_ha_target
done=0
while test "$done" = "0"; do
case "$1" in
-h) ha_host=$2; shift; shift;;
-t) target=$2; shift; shift;;
-c) do_clean=$2; shift; shift;;
-C) do_config=$2; shift; shift;;
"") done=1;;
*) echo "unknown option: $1"; return 1;;
esac
done
if [ -z $ha_host ]; then
echo You must specify a host to build on.
return 1
fi
echo -ne "\033]0;Cleaning up $ha_host\007"
`which ssh` root@${ha_host} "/etc/init.d/heartbeat stop"
`which ssh` root@${ha_host} "killall -9 heartbeat ccm lrmd crmd"
`which ssh` root@${ha_host} "rm -f /var/lib/heartbeat/crm/*
/tmp/te.log /tmp/pe.log /var/log/crmd.* /var/log/ha.*"
echo -ne "\033]0;Syncing $target to $ha_host\007"
sync_to -h $ha_host -t $target
if [ $do_config = 1 ]; then
echo -ne "\033]0;Configuring $target on $ha_host\007"
`which ssh` root@${ha_host} "cd /home/linux-ha ; ./ConfigureMe cf
--enable-crm"
fi
if [ $do_clean = 1 ]; then
echo -ne "\033]0;Make clean $target on $ha_host\007"
`which ssh` root@${ha_host} "make -C /home/linux-ha clean"
fi
echo -ne "\033]0;Building $target on $ha_host\007"
`which ssh` root@${ha_host} "make -C /home/linux-ha install"
# `which ssh` root@${ha_host} ""
echo -ne "\033]0;Pushing config to $ha_host\007"
scp $devel_home/linux-ha-config/* root@${ha_host}:/etc/ha.d/
echo Build complete for $target on $ha_host
echo -ne "\033]0;Build complete - $target on $ha_host\007"
}
function sync_to() {
target=$default_ha_target
done=0
while test "$done" = "0"; do
case "$1" in
-h) ha_host=$2; shift; shift;;
-t) target=$2; shift; shift;;
-c) do_clean=1; shift;;
"") done=1;;
*) echo "unknown option: $1"; return 1;;
esac
done
if [ -z $ha_host ]; then
echo You must specify a host to build on.
return 1
fi
echo Synching $target to $ha_host
rsync -avzxlSDC --progress \
--exclude=.gres.* \
--exclude=.libs \
--exclude=.deps \
--exclude=compile \
--exclude=depcomp \
--exclude=CVS \
--exclude=TAGS \
--include=.h \
--include=test.h \
--include=.c \
--exclude=today.diff \
$devel_home/${target}/ ${ha_host}::ha/
echo Synched $target to $ha_host
}
--
Andrew Beekhof
"Ooo Ahhh, Glenn McRath" - TISM
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic