lpohl/pha
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
#####################################################
# pha - Perl High Availability Toolkit #
#####################################################
Software to keep scriptable service(s) alive on one of two nodes.
In this development example it is an virtual IP and the http service scripted trough the shell scripts in ./res/.
folders & files:
./README
# pha configuration file
./etc/config
# programms
./bin/pha-cli.pl
./bin/pha-supervise.pl
./bin/pha-receiver.pl
./bin/pha-sender.pl
# Libary with common functions, used by pha-*.pl
./lib/pha.pm
# pids and logs
./var/run/
./var/log.*
# ressource scripts, look into test for an example what they must provide! (start, stop, check)
./res/
./res/service
./res/ipaddr
./res/test
#
# set a nice shell prompt status indicator:
#
# this one would work with bash, place it in your profile,
# may be .bashrc, .profile or .bash_profile
#
# or even global in /etc/bashrc or /etc/profile
#
getPromptStatus()
{
ls /opt/pha/var/run/{receiver,sender,supervise} >/dev/null 2>&1
if [ $? != 0 ]; then
status='NOTRUNNING'
else
if [ "$(/opt/pha/bin/getst.pl 2>/dev/null)" == "ONLINE" ]; then
status='Active'
else
status='Standby'
fi
fi
echo $status
}
# the PS1 is to set somewhere in bashrc or profile, some examples:
# debian
# PS1="${debian_chroot:+($debian_chroot)}\u@\h:[\$(getPromptStatus)] \w\$ "
# RHEL 5 like
# PS1="[\u@\h:\$(getPromptStatus)] \W \\$ "