#!/bin/bash
#
# ovirt Start ovirt services
#
# chkconfig: 3 98 02
# description: ovirt-post services
#

# Source functions library
. /etc/init.d/functions
. /etc/init.d/ovirt-functions

start() {
    find_srv identify tcp

    if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
        ovirt-identify-node -s $SRV_HOST -p $SRV_PORT
    else
        echo "skipping ovirt-identify-node, oVirt registration service not available"
    fi
}

case "$1" in
    start)
        printf "Starting ovirt-post: "

        {
            start
        } >> $OVIRT_LOGFILE 2>&1

        test $? -eq 0 &&  success || failure
        echo
        ;;
    *)
        echo "Usage: ovirt-post {start}"
        exit 2
esac
