File: ipmipower.dev

package info (click to toggle)
powerman 2.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,432 kB
  • sloc: ansic: 19,458; sh: 7,225; yacc: 694; makefile: 455; lex: 272
file content (72 lines) | stat: -rw-r--r-- 1,675 bytes parent folder | download | duplicates (2)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# $Id$
#
# This device configuration supports power control via the FreeIPMI
# 'ipmipower' utility.
#
# Powerman.conf will typically be setup like this:
#
#   include "/etc/powerman/ipmipower.dev"
#   device "ipmipower1" "ipmipower" "/usr/sbin/ipmipower -h pnode1 --wait-until-on --wait-until-off |&"
#   node "node1" "ipmipower1" "pnode1"
#
# It may also be necessary to configure a username and password for
# ipmipower.  It may be configured on the command line above or
# (recommended) via the FreeIPMI configuration file.
#
# some IPMI devices require some time for the firmware to
# reload/re-settle itself after a power-off.  A delay of 5 seconds
# seems to work fine pretty well.
#
# off,delay,on used in place of IPMI cycle to ensure full command
# completion before returning to the user.
#
specification "ipmipower" {
	timeout  	60

	script login {
		expect "ipmipower> "
	}
	script logout {
		send "quit\n"
	}
	script status_all {
		send "stat\n"
		foreachnode {
			expect "([^\n:]+): ([^\n]+\n)"
			setplugstate $1 $2 on="^on\n" off="^off\n"
		}
		expect "ipmipower> "
	}
	script status_beacon_all {
		send "identify-status\n"
		foreachnode {
			expect "([^\n:]+): ([^\n]+\n)"
			setplugstate $1 $2 on="^on\n" off="^off\n"
		}
		expect "ipmipower> "
	}
	script on_ranged {
		send "on %s\n"
		expect "ipmipower> "
	}
	script off_ranged {
		send "off %s\n"
		expect "ipmipower> "
	}
	script cycle_ranged {
		send "off %s\n"
		expect "ipmipower> "
		delay 5
		send "on %s\n"
		expect "ipmipower> "
	}
	script beacon_on_ranged {
		send "identify-on %s\n"
		expect "ipmipower> "
	}
	script beacon_off_ranged {
		send "identify-off %s\n"
		expect "ipmipower> "
	}
}