summaryrefslogtreecommitdiff
path: root/scripts/ipmiutil.setup
blob: 0330a292b8654dbd4caf7668e2755c2ec3636db3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/sh
# ipmiutil ipmi_port setup script for systemd
#

. /usr/share/ipmiutil/ipmiutil.env

getpid () {
    # This is messy if the parent script is same name as $1
    p=`ps -ef |grep "$1" |grep -v grep |awk '{print $2}'`
    echo $p
}

isetup() {
	retval=1
	PID=0
        
	mkdir -p $IVARDIR
	if [ ! -f $ISENSOROUT ]; then
	   # Capture a snapshot of IPMI sensor data for later reuse.
	   ipmiutil sensor -q >$ISENSOROUT
	fi
	if [ -f $ITHRESH ]
	then
	   # apply saved IPMI sensor thresholds, if any
	   sh $ITHRESH
	fi
	if [ -d ${IMIBDIR} ]
	then
	   # put bmclanpet MIB where SNMP can find it
	   cp -f $IDATADIR/bmclanpet.mib ${IMIBDIR}/BMCLAN-PET-MIB.txt
	fi

	dpc=`getpid dpcproxy`
	if [ "x${dpc}" != "x" ]
	then
	   echo "dpcproxy is already running on port 623, so not needed."
	   retval=6
	else
	   # portmap may have been replaced by portreserve 
       # only need ipmi_port if portmap exists
	   if [ -x $IPORTMAP ]
	   then
	      retval=0
	   else
	      retval=6
	   fi
	fi
	return $retval
}

isetup