Win Unix Mac

Articles,How Tos,Tips n more

  • Increase font size
  • Default font size
  • Decrease font size

An init script for Pen and Vrrpd on RedHat style Linux

E-mail Print PDF

Pen is a load balancer daemon with a single point of failure which is made redundant with Vrrpd. Below is an example Init Script for Fedora / RedHat style init scripts:

#!/bin/bash

#

# production        Starts production service.

#

#

# chkconfig: 2345 12 88

# description: Production daemon for LVPHA (Linux Vrrp Pen High Availability) \

# A redundant and load balanced TCP clustering stab

### BEGIN INIT INFO

# Provides: $production

### END INIT INFO

# Source function library.

. /etc/init.d/functions

. /data/etc/profile

 

RETVAL=0

start() {

echo -n $"Starting up vrrpd and pen: "

if [ -e /var/lock/subsys/production ]; then

if [ -e /var/run/pen.pid ] && [ -e /var/run/vrrpd*.pid ] && [ -e /proc/`cat /var/run/vrrp*.pid` ] && [ -e /proc/`cat /var/run/pen.pid` ]  ; then

echo -n $"cannot start production: production is already running.";

failure $"cannot start production: production already running.";

echo

return 1

fi

fi

/sbin/runpen

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && touch /var/lock/subsys/production

return $RETVAL

}

stop() {

killproc vrrpd && killproc pen

echo -n $"Shutting down vrrpd and pen: "

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/production

return $RETVAL

}

rhstatus() {

status vrrpd

status pen

}

restart() {

stop

start

}

case "$1" in

start)

start

;;

stop)

stop

;;

status)

rhstatus

;;

restart)

restart

;;

*)

echo $"Usage: $0 {start|stop|status|restart}"

exit 2

esac

 

exit $?

 

 

Add your comment

Your name:
Subject:
Comment:

yvcomment, category: "Unix How To's"