-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathipmi
More file actions
executable file
·58 lines (52 loc) · 1.16 KB
/
Copy pathipmi
File metadata and controls
executable file
·58 lines (52 loc) · 1.16 KB
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
53
54
55
56
57
58
#!/bin/bash
# Time saver for ipmitool
#
# Reduces:
# ipmitool -I lanplus -H 10.20.0.14 -U admin -P iloadmin sol activate
#
# To:
# ipmiwrap 10.20.0.14 console
usage () {
echo "Usage: $0 <host> <command>"
echo
echo host: hostname or IP address of controller
echo "command: <native ipmitool command> e.g. help"
echo "command: console | bootnet | reboot"
exit ${RC:-2}
}
# Only check we have 2 or more agruments
[ $# -ge 2 ] || usage
host=$1
shift
command=$*
ipmitoolcmd="ipmitool -I lanplus -H $host -U admin -E"
case "$command" in
console)
# Connect to the serial console
$ipmitoolcmd sol deactivate
$ipmitoolcmd sol activate
;;
bootnet)
# Boot from the network with PXE boot
$ipmitoolcmd chassis bootdev pxe
;;
bootdisk)
# Boot from the network with PXE boot
$ipmitoolcmd chassis bootdev disk
;;
reboot)
# Reboot the server
$ipmitoolcmd chassis power reset
;;
bnc)
# boot net console
$ipmitoolcmd chassis power reset
$ipmitoolcmd chassis bootdev pxe
$ipmitoolcmd sol deactivate
$ipmitoolcmd sol activate
;;
*)
# Just run whatever was passed in
$ipmitoolcmd $command
;;
esac