works for zenoss 2.4 on PCBSDv1.3(FreeBSD 6.1)
Code:
#!/usr/bin/env bash
# PROVIDE: zenoss
# REQUIRE: mysql
# KEYWORD: SHUTDOWN
#
# Add the following to /etc/rc.conf to enable this service
#
# zenoss_enable="YES"
#
###
### STRAIGHT OUT OF THE zenoss original Linux script
### Modified by Beto Meijome - [EMAIL PROTECTED] for FreeBSD (rcNG)
### Modified by Matt Gordon to support zenoss 2.4 & FreeBSD
###
#
# Zenoss is a monitoring program written by Zenoss, Inc.
export ZENHOME=/usr/local/zenoss
export PYTHONPATH=$ZENHOME/lib/python
export PATH=$ZENHOME/bin:$PATH
. /etc/rc.subr
name="zenoss"
rcvar=`set_rcvar`
start_cmd="ze_start"
stop_cmd="ze_stop"
status_cmd="ze_status"
restart_cmd="ze_restart"
extra_commands="restart status"
my_scriptname="/usr/local/etc/rc.d/$name"
# read configuration and set defaults
load_rc_config "$name"
: ${zenoss_enable="NO"}
if [ -z "$ZENHOME" ] ; then
for d in $HOME /home/zenoss ; do
for f in .bash_login .bash_profile .profile .bashrc ; do
if [ -z "$ZENHOME" ] ; then
[ -f $d/$f ] && . $d/$f
fi
done
done
fi
if [ -z "$ZENHOME" ] ; then
ZENHOME=/usr/local/zenoss; export ZENHOME
fi
if [ `id -u` -eq 0 ] ; then
USERNAME=`ls -l $ZENHOME/var/Data.fs | awk '{ print $3 }'`
if [ "$USERNAME" = "root" -o -z "$USERNAME" ] ; then
echo Unable to determine the right user to run zenoss
exit 1
fi
chown -R $USERNAME $ZENHOME/var
exec su - $USERNAME $my_scriptname $@
fi
. $ZENHOME/bin/zenfunctions
C=
C="$C zeoctl"
C="$C zopectl"
C="$C zenhub"
C="$C zenping"
C="$C zensyslog"
C="$C zenstatus"
C="$C zenactions"
C="$C zentrap"
C="$C zenmodeler"
#C="$C zenrender"
C="$C zenperfsnmp"
C="$C zencommand"
C="$C zenprocess"
C="$C zenmail"
if [ -f $ZENHOME/lib/python/pywmi.py ]
then
C="$C zenwin"
C="$C zeneventlog"
C="$C zenwinmodeler"
fi
for i in $ZENHOME/Products/*/daemons/*
do
if [ -x "$i" ]
then
C="$C `basename $i`"
fi
done
CMDS=$C
reverse() {
args=
for i
do
args="$i $args"
shift
done
echo $args
}
clean_FUNC() {
## The OTHER zenoss rc scripts dont understand BSD faststart , forcestart,etc...
##need to collapse them into start or stop
## But we (BSD) need the full cmd, so we dont modify FUNC
case "$FUNC" in
faststart)
FUNC2="start"
;;
forcestart)
FUNC2="start"
;;
faststop)
FUNC2="stop"
;;
forcestop)
FUNC2="stop"
;;
*)
FUNC2=$FUNC
;;
esac
}
FUNC=$CMD
issue() {
#Cleanup FUNC for zenoss original scripts.
# Original FUNC is left as is.
clean_FUNC
for cmd in $CMDS
do
echo -n "Daemon: $cmd "
$ZENHOME/bin/$cmd "$FUNC2"
done
}
ze_start(){
issue
}
ze_stop(){
CMDS=`reverse $CMDS`
issue
}
ze_restart(){
CMDS=`reverse $CMDS`
FUNC=stop
issue
CMDS=`reverse $CMDS`
FUNC=start
issue
}
ze_status(){
issue
}
run_rc_command "$CMD"
------------------------
matt gordon
-------------------- m2f --------------------
Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=10224#10224
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users