All -
Have not been here long, however I wanted to do my part and contribute. Below is a script that I modified from an original for 2.6 along with a ton of input from other posts here and on voip-info, etc. I have given credit in the script to the original core script that I used but thanks to everyone! It is not perfect and does need some spit and polish I do not code for a living. That said my idea was to add this to the help-trixbox menu as install-tbcluster. Perhaps someone can take it from here and make it pretty with prompted input for the variables, etc. Who knows maybe even work to get it into the core code and maintained....I would be willing to do what I can. Anyway, I hope someone finds this useful. Let me know and without further adeu.....:
#!/bin/bash
#
#
# For this script to run correctly you must install Trixbox using the Advanced settings and set your partitions like this:
#/dev/sda1 /boot
#/dev/sda2 /
#/dev/sda3 /share
#/dev/sda4 swap
#
# Your servers should also be set up as described below:
# The server has two network interfaces
# eth0 is used to communication to the LAN
# eth1 is used for Heartbeat and is connected via a crossover cable
#
# Trixbox PBX Cluster Configuration Script for version 2.8.0.1
# Original Taken from http://www.voip-info.org/wiki/view/TrixBox%20High%20Availability%... (Royce) for 2.6
#
# Updated Bradley D. Jensen - bjensen@onenetwork.com (20090824).
#
# Make sure you edit this section to your requirements! Start
cluster_ip='{your_cluster_ip}'
domain_name="{your_domain_name}"
gateway='{your_default_gateway}'
primary_dns='{your_primary_dns}'
secondary_dns='{your_secondary_dns}'
master_hostname='{primary_hostname}'
master_ip_address_eth0='{primary_eth0_ip}'
master_ip_address_eth1='{primary_eth1_ip}'
slave_hostname='{slave_hostname}'
slave_ip_address_eth0='{slave_eth0_ip}'
slave_ip_address_eth1='{slave_eth1_ip}'
subnet_mask_eth0='{eth0_mask}'
subnet_mask_eth1='{eth1_mask}'
drbd_disk='{ex:/dev/sda3}'
drbd_device='/dev/drbd0'
# Make sure you edit this section to your requirements! End
clear
echo "TrixBox High Availability Cluster Installation Script"
echo
echo "1. Master node"
echo "2. Master node (pause after each section)"
echo "3. Slave node"
echo "4. Slave node (pause after each section)"
echo "5. Exit"
echo
echo -n "Please select the installation type. "
keypress="0"
until [ $keypress = "1" ] || [ $keypress = "2" ] || [ $keypress = "3" ] || [ $keypress = "4" ] || [ $keypress = "5" ]; do
read -s -n 1 keypress
done
case $keypress in
1)
node='master'
debug=0
server_hostname=$master_hostname
server_ip_address_eth0=$master_ip_address_eth0
server_ip_address_eth1=$master_ip_address_eth1
;;
2)
node='master'
debug=1
server_hostname=$master_hostname
server_ip_address_eth0=$master_ip_address_eth0
server_ip_address_eth1=$master_ip_address_eth1
;;
3)
node='slave'
debug=0
server_hostname=$slave_hostname
server_ip_address_eth0=$slave_ip_address_eth0
server_ip_address_eth1=$slave_ip_address_eth1
;;
4)
node='slave'
debug=1
server_hostname=$slave_hostname
server_ip_address_eth0=$slave_ip_address_eth0
server_ip_address_eth1=$slave_ip_address_eth1
;;
5)
echo
exit
;;
esac
clear
echo "Installation will continue with the following settings:"
echo
echo "Cluster IP address -" $cluster_ip
echo
echo "Node name -" $server_hostname.$domain_name
echo "Node IP address (eth0) -" $server_ip_address_eth0
echo "Node IP address (eth1) -" $server_ip_address_eth1
echo "Node Subnet mask (eth0) -" $subnet_mask_eth0
echo "Node Subnet mask (eth1) -" $subnet_mask_eth1
echo "Node Gateway -" $gateway
echo "Node Primary DNS -" $primary_dns
echo "Node Secondary DNS -" $secondary_dns
echo "Master node name -" $master_hostname.$domain_name
echo "Master node IP address (eth0) -" $master_ip_address_eth0
echo "Master node IP address (eth1) -" $master_ip_address_eth1
echo "Slave node name -" $slave_hostname.$domain_name
echo "Slave node IP address (eth0) -" $slave_ip_address_eth0
echo "Slave node IP address (eth1) -" $slave_ip_address_eth1
echo "DRBD disk partition -" $drbd_disk
echo "DRBD device -" $drbd_device
if [ $debug == 1 ]
then
echo
echo "Script will pause after each section has finished."
fi
echo
echo
echo -n "Press 'Y' to proceed, 'N' to exit. "
keypress="a"
until [ $keypress = "y" ] || [ $keypress = "Y" ] || [ $keypress = "n" ] || [ $keypress = "N" ]; do
read -s -n 1 keypress
done
echo
if [ $keypress = "n" ] || [ $keypress = "N" ]
then
echo "Installation aborted."
exit;
fi
echo "Starting Trixbox $node node cluster installation."
# First create a backup location for changed files.
mkdir /CIBackups
# Update all installed packages
rpm -e --nodeps $(rpm -qa | grep kmod-mISDN) #Dirty but resolves issues with fresh install and repo dependency resolution.
rpm -e --nodeps $(rpm -qa | grep kmod-dahdi-linux) #Dirty but resolves issues with fresh install and repo dependency resolution.
yum -y update
rpm -e --nodeps $(rpm -qa | grep kmod-mISDN) #Dirty but resolves issues with fresh install and repo dependency resolution.
yum -y update
yum -y install kmod-dahdi-linux #Ensure that this package is re-installed before we continue.
echo
echo "Phase 'Update all installed packages' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Download the required files that are not in the current trixbox repository
wget -nv -P /tmp ftp://ftp.tummy.com/pub/tummy/drbdlinks/drbdlinks-1.18-1.noarch.r... #Only RPM that is not in the default repos
echo
echo "Phase 'Download required packages' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Install the downloaded RPMs above
rpm -ih /tmp/drbdlinks-1.18-1.noarch.rpm
yum -y install drbd82 kmod-drbd82 #Installs DRBD and the associated Kernel Module
echo
echo "Phase 'Installing downloaded packages' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Install the redhat-lsb scripts so that drbdlinks runs correctly
yum -y install redhat-lsb
echo
echo "Phase 'Install lsb scripts' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
#install heartbeat ( needed to do this twice!! for some reason heartbeat doesn't install the first time? )
yum -y install heartbeat
yum -y install heartbeat
echo
echo "Phase 'Install heartbeat' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Change the hostname
echo $server_hostname.$domain_name >> /etc/hostname
mv /etc/sysconfig/network /etc/sysconfig/network.backup
cp /etc/sysconfig/network.backup /CIBackups #Save a copy of the original to another location.
sed "s/HOSTNAME=trixbox1.localdomain/HOSTNAME=$server_hostname.$domain_name/g" /etc/sysconfig/network.backup > /etc/sysconfig/network
mv /etc/hosts /etc/hosts.backup
cp /etc/hosts.backup /CIBackups #Save a copy of the original to another location.
sed "s/trixbox1.localdomain/$server_hostname.$domain_name/g" /etc/hosts.backup > /etc/hosts
mv /etc/hosts /etc/hosts.backup2
cp /etc/hosts.backup2 /CIBackups #Save a copy of the original to another location.
sed "s/trixbox1/$server_hostname/g" /etc/hosts.backup2 > /etc/hosts
sudo /bin/hostname -F /etc/hostname
echo
echo "Phase 'Change hostname' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Configure eth0
mv /etc/sysconfig/network-scripts/ifcfg-eth0 /CIBackups/ifcfg-eth0.backup #Save a copy of the original to another location.
cat > /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=$server_ip_address_eth0
NETMASK=$subnet_mask_eth0
EOF
echo
echo "Phase 'Change eth0 settings' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Configure eth1
mv /etc/sysconfig/network-scripts/ifcfg-eth1 /CIBackups/ifcfg-eth1.backup #Save a copy of the original to another location.
cat > /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=$server_ip_address_eth1
NETMASK=$subnet_mask_eth1
EOF
echo
echo "Phase 'Change eth1 settings' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Update hosts file adding an entries so each node can find each other
cat > /etc/hosts
$master_ip_address_eth0 $master_hostname.$domain_name $master_hostname
$slave_ip_address_eth0 $slave_hostname.$domain_name $slave_hostname
EOF
mv /etc/resolv.conf /CIBackups/resolv.conf.backup #Save a copy of the original to another location.
cat > /etc/resolv.conf
nameserver $primary_dns
nameserver $secondary_dns
EOF
echo "GATEWAY=$gateway" >> /etc/sysconfig/network
echo
echo "Phase 'Update /etc/hosts, /etc/resolv.conf and adding default gateway' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Restart the network
service network restart
echo
echo "Phase 'Network restart' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Configure /etc/drbd.conf
mv /etc/drbd.conf /CIBackups/drbd.conf.backup #Save a copy of the original to another location.
cat > /etc/drbd.conf
global {
usage-count yes;
}
common {
syncer { rate 64M; } #Found several different settings and decided to go with something in the middle.
# limited artifically low to leave
# bandwidth for the zaptel TDMoE Driver
# DRBD performance seems to max out
# about here anyway on my 1950 setup
}
resource drbd0 {
protocol C;
handlers {
outdate-peer "/usr/lib/heartbeat/drbd-peer-outdater";
}
startup {
wfc-timeout 60;
degr-wfc-timeout 120; # 2 minutes.
}
disk {
on-io-error detach;
fencing resource-only;
}
net {
after-sb-0pri discard-younger-primary;
after-sb-1pri consensus;
after-sb-2pri disconnect;
cram-hmac-alg sha1;
shared-secret "B0h1cazz";
}
syncer {
rate 64M;
}
on $master_hostname.$domain_name {
device $drbd_device;
disk $drbd_disk;
address $master_ip_address_eth1:7788;
meta-disk internal;
}
on $slave_hostname.$domain_name {
device $drbd_device;
disk $drbd_disk;
address $slave_ip_address_eth1:7788;
meta-disk internal;
}
}
EOF
echo "Phase 'Create drbd.conf' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Update drbd0/share partition from /etc/fstab
umount /share
mv /etc/fstab /etc/fstab.backup
cp /etc/fstab.backup /CIBackups/fstab.backup #Save a copy of the original to another location.
sed '/share/d' /etc/fstab.backup > /etc/fstab
if [ ! -e /share ]
then
mkdir /share
fi
cat > /etc/fstab
$drbd_device /share ext3 defaults,noauto 0 0
EOF
echo
echo "Phase 'Update drbd0/share partition from /etc/fstab' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Create drbd node
dd if=/dev/zero bs\=1M count\=1 of\=$drbd_disk; sync #Need to inspect the logic. Did not succeed on my slave node. Had to do it manually.
drbdadm create-md drbd0 #
chgrp haclient /sbin/drbdsetup #
chmod o-x /sbin/drbdsetup #
chmod u+s /sbin/drbdsetup #
chgrp haclient /sbin/drbdmeta #
chmod o-x /sbin/drbdmeta #
chmod u+s /sbin/drbdmeta #
service drbd start #
#
echo #
echo "Phase 'Create drbd0 node' complete." #
if [ $debug == 1 ] #
then #
echo "Press any key to continue." #
read -n 1 keypress #
fi #
echo #
#
# Make primary drbd node #
if [ $node == "master" ] #
then #
drbdadm -- --overwrite-data-of-peer primary all #
mkfs.ext3 $drbd_device #
mount $drbd_device #Need to inspect the logic. Did not succeed on my slave node. Had to do it manually.
echo
echo "Phase 'Make primary node' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
fi
# Stop the services whos data and/or configurations we are moving to the drbd shared disk
service mysqld stop
service postfix stop
service asterisk stop
service httpd stop
service ircd stop
service xinetd stop
echo
echo "Phase 'Stop running services' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Create /etc/drbdlinks.conf
mv /etc/drbdlinks.conf /CIBackups/drbdlinks.conf.backup #Save a copy of the original to another location.
cat > /etc/drbdlinks.conf
mountpoint('/share')
link('/var/ftp')
link('/var/spool/asterisk')
link('/var/spool/vbox')
link('/var/trixbox_load')
link('/var/www')
link('/var/lib/asterisk')
link('/var/lib/dav')
link('/var/lib/mysql')
link('/var/lib/php')
link('/etc/asterisk')
link('/etc/httpd')
link('/etc/php.d')
link('/etc/postfix')
link('/etc/vsftpd')
link('/etc/vsftpd.user_list')
link('/etc/aliases')
link('/etc/aliases.db')
link('/etc/amportal.conf')
link('/etc/dahdi')
link('/etc/dhcpd.conf')
link('/etc/fxotune.conf')
link('/etc/my.cnf')
link('/etc/php.ini')
link('/etc/xinetd.conf')
link('/etc/xinetd.d')
link('/tftpboot')
EOF
echo
echo "Phase 'Create drbdlinks.conf' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
if [ $node == "master" ]
then
# Backup and move the data creating the entries in /etc/drbdlinks.conf as we go
cd /share
# /var/ftp
echo "Moving /var/ftp started."
tar -zcf var-ftp.tar.gz /var/ftp
tar -zxf var-ftp.tar.gz
echo "Moving /var/ftp completed."
echo
# /var/spool/asterisk
echo "Moving /var/spool/asterisk started."
tar -zcf var-spool-asterisk.tar.gz /var/spool/asterisk
tar -zxf var-spool-asterisk.tar.gz
echo "Moving /var/spool/asterisk completed."
echo
# /var/spool/vbox
echo "Moving /var/spool/vbox started."
tar -zcf var-spool-vbox.tar.gz /var/spool/vbox
tar -zxf var-spool-vbox.tar.gz
echo "Moving /var/spool/vbox completed."
echo
# /var/trixbox_load
echo "Moving /var/trixbox_load started."
tar -zcf var-trixbox_load.tar.gz /var/trixbox_load
tar -zxf var-trixbox_load.tar.gz
echo "Moving /var/trixbox_load completed."
echo
# /var/www
echo "Moving /var/www started."
tar -zcf var-www.tar.gz /var/www
tar -zxf var-www.tar.gz
echo "Moving /var/www completed."
echo
# /var/lib/asterisk
echo "Moving /var/lib/asterisk started."
tar -zcf var-lib-asterisk.tar.gz /var/lib/asterisk
tar -zxf var-lib-asterisk.tar.gz
echo "Moving /var/lib/asterisk completed."
echo
# /var/lib/dav
echo "Moving /var/lib/dav started."
tar -zcf var-lib-dav.tar.gz /var/lib/dav
tar -zxf var-lib-dav.tar.gz
echo "Moving /var/lib/dav completed."
echo
# /var/lib/mysql
echo "Moving /var/lib/mysql started."
tar -zcf var-lib-mysql.tar.gz /var/lib/mysql
tar -zxf var-lib-mysql.tar.gz
echo "Moving /var/lib/mysql completed."
echo
# /var/lib/php
echo "Moving /var/lib/php started."
tar -zcf var-lib-php.tar.gz /var/lib/php
tar -zxf var-lib-php.tar.gz
echo "Moving /var/lib/php completed."
echo
# /etc/asterisk
echo "Moving /etc/asterisk started."
tar -zcf etc-asterisk.tar.gz /etc/asterisk
tar -zxf etc-asterisk.tar.gz
echo "Moving /etc/asterisk completed."
echo
# /etc/httpd
echo "Moving /etc/httpd started."
tar -zcf etc-httpd.tar.gz /etc/httpd
tar -zxf etc-httpd.tar.gz
echo "Moving /etc/httpd completed."
echo
# /etc/php.d
echo "Moving /etc/php.d started."
tar -zcf etc-php.d.tar.gz /etc/php.d
tar -zxf etc-php.d.tar.gz
echo "Moving /etc/php.d completed."
echo
# /etc/postfix
echo "Moving /etc/postfix started."
tar -zcf etc-postfix.tar.gz /etc/postfix
tar -zxf etc-postfix.tar.gz
echo "Moving /etc/postfix completed."
echo
# /etc/vsftpd
echo "Moving /etc/vsftpd started."
tar -zcf etc-vsftpd.tar.gz /etc/vsftpd
tar -zxf etc-vsftpd.tar.gz
echo "Moving /etc/vsftpd completed."
echo
# /etc/vsftpd.user_list
echo "Moving /etc/vsftpd.user_list started."
tar -zcf etc-vsftpd_user_list.tar.gz /etc/vsftpd.user_list
tar -zxf etc-vsftpd_user_list.tar.gz
echo "Moving /etc/vsftpd.user_list completed."
echo
# /etc/aliases
echo "Moving /etc/aliases started."
tar -zcf etc-aliases.tar.gz /etc/aliases
tar -zxf etc-aliases.tar.gz
echo "Moving /etc/aliases completed."
echo
# /etc/aliases.db
echo "Moving /etc/aliases.db started."
tar -zcf etc-aliases_db.tar.gz /etc/aliases.db
tar -zxf etc-aliases_db.tar.gz
echo "Moving /etc/aliases.db completed."
echo
# /etc/amportal.conf
echo "Moving /etc/amportal.conf started."
tar -zcf etc-amportal_conf.tar.gz /etc/amportal.conf
tar -zxf etc-amportal_conf.tar.gz
echo "Moving /etc/amportal.conf completed."
echo
# /etc/dahdi
echo "Moving /etc/dahdi started."
tar -zcf etc-dahdi.tar.gz /etc/dahdi
tar -zxf etc-dahdi.tar.gz
echo "Moving /etc/dahdi completed."
echo
# /etc/dhcpd.conf
echo "Moving /etc/dhcpd.conf started."
tar -zcf etc-dhcpd_conf.tar.gz /etc/dhcpd.conf
tar -zxf etc-dhcpd_conf.tar.gz
echo "Moving /etc/dhcpd.conf completed."
echo
# /etc/fxotune.conf
echo "Moving /etc/fxotune.conf started."
tar -zcf etc-fxotune.conf.tar.gz /etc/fxotune.conf
tar -zxf etc-fxotune.conf.tar.gz
echo "Moving /etc/fxotune.conf completed."
echo
# /etc/my.cnf
echo "Moving /etc/my.cnf started."
tar -zcf etc-my_cnf.tar.gz /etc/my.cnf
tar -zxf etc-my_cnf.tar.gz
echo "Moving /etc/my.cnf completed."
echo
# /etc/php.ini
echo "Moving /etc/php.ini started."
tar -zcf etc-php_ini.tar.gz /etc/php.ini
tar -zxf etc-php_ini.tar.gz
echo "Moving /etc/php.ini completed."
echo
# /etc/xinetd.conf
echo "Moving /etc/xinetd.conf started."
tar -zcf etc-xinetd_conf.tar.gz /etc/xinetd.conf
tar -zxf etc-xinetd_conf.tar.gz
echo "Moving /etc/xinetd.conf completed."
echo
# /etc/xinetd.d
echo "Moving /etc/xinetd.d started."
tar -zcf etc-xinetd_d.tar.gz /etc/xinetd.d
tar -zxf etc-xinetd_d.tar.gz
echo "Moving /etc/xinetd.d completed."
echo
# /tftpboot
echo "Moving /tftpboot started."
tar -zcf tftpboot.tar.gz /tftpboot
tar -zxf tftpboot.tar.gz
echo "Moving /tftpboot completed."
echo
# First for sanity sake we stash the zips away should things go pear shaped.
mv /share/*.tar.gz /CIBackups
# Fix some symlinks for /etc/httpd
rm -fr /share/etc/httpd/logs
rm -fr /share/etc/httpd/modules
rm -fr /share/etc/httpd/run
ln -s /var/log/httpd /share/etc/httpd/logs
ln -s /usr/lib/httpd/modules /share/etc/httpd/modules
ln -s /var/run /share/etc/httpd/run
echo
echo "Phase 'Data move' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
fi
# Tidy up installation by deleting data that is on our drbd disk - REMOVED BDJ - Had issues early on with loosing the originals as well. Removed to prevent that.
#rm -rf /tftpboot/*
#rm -rf /etc/postfix/*
#rm -rf /etc/php.d/*
#rm -rf /etc/ircd/*
#rm -rf /etc/httpd/*
#rm -rf /etc/asterisk/*
#rm -rf /var/lib/php/*
#rm -rf /var/lib/mysql/*
#rm -rf /var/lib/ircd/*
#rm -rf /var/lib/dav/*
#rm -rf /var/lib/asterisk/*
#rm -rf /var/www/*
#rm -rf /var/trixbox_load/*
#rm -rf /var/spool/vbox/*
#rm -rf /var/spool/mail/*
#rm -rf /var/spool/asterisk/*
#rm -rf /var/ftp/*
#echo
#echo "Phase 'Deleting replicated data from original location' complete."
#if [ $debug == 1 ]
#then
# echo "Press any key to continue."
# read -n 1 keypress
#fi
#echo
# Configure /etc/ha.d/ha.cf
mv /etc/ha.d/ha.cf /CIBackups/ha.cf.backup #Save a copy of the original to another location.
cat > /etc/ha.d/ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0 # This is deprecated
keepalive 1 # Interval between heartbeat (HB«») packets.
deadtime 10 # How quickly HB determines a dead node.
warntime 5 # Time HB will issue a late HB.
initdead 120 # Time delay needed by HB to report a dead node.
udpport 694 # UDP port HB uses to communicate between nodes.
#ping 192.168.160.103 # Ping virtual host to simulate network resource.
bcast eth1 # Which interface to use for HB packets.
auto_failback on # Auto promotion of primary node upon return to cluster.
node $master_hostname.$domain_name
node $slave_hostname.$domain_name
#respawn hacluster /usr/lib/heartbeat/ipfail
EOF
echo
echo "Phase 'Create ha.cf' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Configure /etc/ha.d/haresources
mv /etc/ha.d/haresources /CIBackups/haresources.backup #Save a copy of the original to another location.
cat > /etc/ha.d/haresources
$master_hostname.$domain_name $cluster_ip/$subnet_mask_eth0/eth0 drbddisk::drbd0 Filesystem::$drbd_device::/share::ext3 drbdlinks mysqld postfix asterisk httpd amportal xinetd
EOF
echo
echo "Phase 'Create haresources' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Configure /etc/ha.d/authkeys
mv /etc/ha.d/authkeys /CIBackups/authkeys.backup #Save a copy of the original to another location.
cat > /etc/ha.d/authkeys
auth 1
1 crc
EOF
chmod 600 /etc/ha.d/authkeys
echo
echo "Phase 'Create authkeys' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Change service startup and shutdown in init scripts
chkconfig --levels 345 mysqld off
chkconfig --levels 345 postfix off
chkconfig --levels 345 asterisk off
chkconfig --levels 345 httpd off
chkconfig --levels 345 xinetd off
chkconfig --levels 345 heartbeat on
echo
echo "Phase 'Change service runlevels' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Create a script for ha-log quick access
echo "tail -f /var/log/ha-log" >> /usr/bin/ha
chmod a+x /usr/bin/ha
echo
echo "Phase 'Create ha-log quick access' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Configure /etc/init.d/amportal
mv /etc/init.d/amportal /CIBackups/amportal.backup #Save a copy of the original to another location.
cat > /etc/init.d/amportal
#! /bin/sh
#
# Source function library.
. /etc/rc.d/init.d/functions
RETVAL=0
PROCNAME=portal
# See how we were called.
case "\$1" in
start)
/usr/sbin/amportal start
RETVAL=0
echo
;;
stop)
/usr/sbin/amportal stop
RETVAL=0
echo
;;
status)
status \$PROCNAME
RETVAL=\$?
;;
restart|reload)
\$0 stop
\$0 start
RETVAL=\$?
;;
*)
echo "Usage: amportal {start|stop|status|restart}"
exit 1
esac
exit \$RETVAL
EOF
chmod 755 /etc/init.d/amportal
echo
echo "Phase 'Create amportal init script' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
# Remove amportal startup configuration from /etc/rc.local
mv /etc/rc.local /etc/rc.local.backup
cp /etc/rc.local.backup /CIBackups/rc.local.backup #Save a copy of the original to another location.
sed '/amportal/d' /etc/rc.local.backup > /etc/rc.local
echo
echo "Phase 'Remove amportal startup configuration from rc.local' complete."
if [ $debug == 1 ]
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
if [ $node == "slave" ]
then
# Test connectivity between the nodes
echo
echo "Phase 'Testing connectivity' complete."
if [ $debug == 1 ]
ping -c 5 $master_hostname.$domain_name
ping -c 5 $slave_hostname.$domain_name
then
echo "Press any key to continue."
read -n 1 keypress
fi
echo
fi
# Start the heartbeat service
service heartbeat start
clear
echo "Trixbox $node node cluster installation finished."
echo
echo "Showing /etc/log/ha-log (Press Ctrl-C to quit)"
echo
/usr/bin/ha
Great work. If we could add
Great work. If we could add that to the wiki that would be really cool!