summaryrefslogtreecommitdiff
path: root/.gitlab-ci/bare-metal/poe-on
blob: de41fc9b8197a3134a09f03450c81f889b1a37a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

if [ -z "$BM_POE_INTERFACE" ]; then
    echo "Must supply the PoE Interface to power up"
    exit 1
fi

if [ -z "$BM_POE_ADDRESS" ]; then
    echo "Must supply the PoE Switch host"
    exit 1
fi

SNMP_KEY="SNMPv2-SMI::mib-2.105.1.1.1.3.1.$((48 + BM_POE_INTERFACE))"
SNMP_ON="i 1"
SNMP_OFF="i 2"

flock /var/run/poe.lock -c "snmpset -v2c -r 3 -t 30 -cmesaci $BM_POE_ADDRESS $SNMP_KEY $SNMP_OFF"
sleep 3s
flock /var/run/poe.lock -c "snmpset -v2c -r 3 -t 30 -cmesaci $BM_POE_ADDRESS $SNMP_KEY $SNMP_ON"