#!/bin/bash
# 
# Copyright (c) 2003-2023 Broadcom. All Rights Reserved.
# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
# 

platform_os=`uname -s`

if [ "$platform_os" = "Linux" ]; then

    ARCH=$(uname -r)
    ioctl_driver="lpfc"

    #  Start the server daemon if module loaded
    lpfc_loaded=`lsmod | awk '{ print $1 }' | grep "$ioctl_driver"`

    # start the OneCommand Management Server last
    if [ ! -z "$lpfc_loaded" ]; then
        echo "Starting elxhbamgrd (via systemctl):"
        systemctl start elxhbamgrd.service
    #else
        # do not try to start Emulex HBA Manager Remote Management daemon because driver not loaded
        # CR 83380; do not display message because this could be linux guest install on vmware
        #echo ""
        #echo "Not starting Emulex HBA Manager Remote Management daemon because $ioctl_driver driver module not loaded."
        #echo "Load $ioctl_driver driver module and retry."
    fi
else
    # [Solaris]
    # Start the elxhbamgrd daemons
    svcadm enable -t application/elxhbamgrd
fi


exit 0
