#!/bin/sh
############################### -*- Mode: Sh -*- ##############################
##
## keepalive --
##
# chkconfig: 345 16 15
# description: Turn on Opsware Agent
##
### BEGIN INIT INFO
# Provides:       opsware-agent
# Default-Start:  3 4 5
# Description:    Turn on Opsware Agent
### END INIT INFO
##
## Copyright (C) 1999-2006: Opsware Inc.
##
## Author          : Ray Suorsa
## Created On      : Sun Feb 13 18:46:22 2000
## Last Modified By: David Vasileff
## Last Modified On: Fri Sep 22 22:40:49 2006
## Update Count    : 95
## Status          : Web software for the real world...
##
## PURPOSE
##    Keepalive script for the shadowbot/daemonbot and its close kin.
##
## HISTORY
## 20-Mar-2000		Ray Suorsa
##    Last Modified: Mon Mar 20 22:07:05 2000 #58 (Ray Suorsa)
##    Heavy mods for daemonbot.py
## 13-Feb-2000		Ray Suorsa
##    Last Modified: Sun Feb 13 18:46:22 2000 #0 (Ray Suorsa)
##    created
###############################################################################

# on hp-ux need to add /usr/bin to search path so can find uptime
# qc117109
PATH=$PATH:/usr/bin
export PATH

set +e # ignore errors that may be encountered sourcing config
#I18NIZE for linux
[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
#I18NIZE for HP-UX
[ -f /etc/rc.config.d/LANG ] && . /etc/rc.config.d/LANG
#I18NIZE for AIX
[ -f /etc/environment ] && . /etc/environment
#I18NIZE for Solaris
[ -f /etc/default/init ] && . /etc/default/init
#override LANG with opsware agent locale
OPSWARE_CONF_PATH=/etc/opt/opsware
[ -f $OPSWARE_CONF_PATH/agent/locale ] &&  . $OPSWARE_CONF_PATH/agent/locale
set -e

export LANG

BOT=agent
export BOT

BOTBASE=/opt/opsware
export BOTBASE

OPSWARE_OPT_PATH=/opt/opsware/agent
export OPSWARE_OPT_PATH

OPSWARE_CONF_PATH=/etc/opt/opsware
export OPSWARE_CONF_PATH

OPSWARE_VAR_PATH=/var/opt/opsware
export OPSWARE_VAR_PATH

OPSWARE_LOG_PATH=/var/log/opsware
export OPSWARE_LOG_PATH

CONF=$OPSWARE_CONF_PATH/$BOT/agent.args

HOME=/root	# rpm needs to expand ~ into a directory
export HOME

# ensure that agent does not inherit python path from parent
PYTHONPATH=
export PYTHONPATH

case "$1" in
    'restart')
        $0 stop
        $0 start
        RETVAL=$?
        exit $RETVAL
        ;;
esac

#
# Don't edit beyond this line :-)
#

. ${OPSWARE_OPT_PATH}/pylibs/shadowbot/etc/shadowfuncs
