This file is indexed.

/usr/share/conmux/drivers/reboot-numaq is in conmux 0.12.0-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#!/usr/bin/expect --
#
# reboot-numaq -- reboot Numa-Q systems connected to a VCS console
#
# Use the remote telnet managment interface on the VCS console to
# hardreset systems.  Systems are identified by their system names
# within VCS.
#
# usage: 
#  reboot-numaq <type> <console IP> <system> <port> <userid> <password>
#
# examples:
#  reboot-numaq vcs 1.2.3.4 hummer 12346 FOO BAR
#
# (C) Copyright IBM Corp. 2004, 2005, 2006
# Author: Andy Whitcroft <andyw@uk.ibm.com>
#
# The Console Multiplexor is released under the GNU Public License V2
#
set P "reboot-numaq"

if { [llength $argv] != 6 } {
	puts stderr "Usage: reboot-numaq vcs <console addr> <system> <console port> <userid> <password>"
	exit 1
}

log_user 0
#stty echo
set argc [llength $argv]
set console_ip		[lindex $argv 1]
set system		[lindex $argv 2]
set console_port	[lindex $argv 3]
set username		[lindex $argv 4]
set password		[lindex $argv 5]

#log_file -a "$logfile"

set elapsed_time 0
set timeout 30

set command "telnet $console_ip $console_port"

proc note {m} {
	global P
	puts "$P: $m"
}
proc warn {m} {
	global P
	puts "$P: WARNING: $m"
}
proc winge {m} {
	global P
	puts "$P: MACHINE ERROR: reboot failed - $m"
}

# CONNECT: connect to the remote console.
note "Logging into VCS console with command \"$command\" to restart it"
eval spawn $command
expect {
	default {
		winge "login prompt not issued"
		exit 2
	}
	"Connection closed by foreign host." {
		winge "Telnet connection closed."
		exit 1
	}
	"Unable to connect to remote host:" {
		winge "Connection to remote console failed";
		exit 2
	}
	"login:" {
		note "saw login prompt"
	}
}

# AUTHENTICATE: send username and password at the relevant prompts
note "sending login ..."
send -- "$username\r"
expect {
	default {
		winge "password prompt not issued"
		exit 2
	}
	"password:" {
		note "password prompt found"
	}
}

note "sending password ..."
send -- "$password\r"
expect {
	default {
		winge "command prompt not issued"
		exit 2
	}
	"Authentication Failed" {
		winge "login/password incorrect ... aborting"
		exit 1
	}
	-- "->" {
		#note "command prompt found"
	}
}

# SYSTEM: try and select the system, if the specified system does not
# exist get a listing and print that out whilst we are connected.
note "selecting system '$system' ..."
send "cd $system\r"
set found 1
expect {
	default {
		winge "command prompt not issued"
		exit 2
	}
	-re "cd: path '.*' not found" {
		winge "system not defined"
		set found 0
		exp_continue
	}
	-- "->" {
		#note "command prompt found"
	}
}

proc list_systems {} {
	note "Defined systems:"
	send "sysdef -l\r"
	expect {
		default {
			winge "command prompt not issued"
			exit 2
		}
		-re "sysdef -l\r\n$" {
			exp_continue
		}
		-- "->" {
			#note "command prompt found"
		}
		"\n$" {
			puts -nonewline "$expect_out(buffer)"
			exp_continue
		}
	}
	note "complete"
}

# The system the user specified was not found, give them a hand by
# getting  a list of systems.
if {$found == 0} {
	list_systems
	note "complete ... exiting"
	send "exit\r"
	exit 1
}

# DOWN: shut the system down ... hard.  Expect to see nothing before the 
# prompt in the case of success.
set timeout 65
set fail 1
for {set retry 1} {$fail == 1 && $retry <= 3} {incr retry} {
	note "powering off the system ..."
	send "power -f -t 60000 off\r"
	set fail 0
	expect {
		default {
			winge "command prompt not issued"
			exit 2
		}
		-- "->" {
			#note "command prompt found"
		}
		"*E*" {
			warn "power off failed ... attempt $retry"
			puts -nonewline "$expect_out(buffer)"
			set fail 1
			exp_continue
		}
	}
}
if {$fail == 1} {
	winge "power off failed ... system not rebooted"
	list_systems
	exit 2
}
set timeout 30

# UP: power the system on ... and then ask it to boot.
note "powering on the system ..."
send "power on\r"
set fail 0
expect {
	default {
		winge "command prompt not issued"
		exit 2
	}
	-- "->" {
		#note "command prompt found"
	}
	"*E*" {
		warn "power on failed ..."
		set fail 1
		exp_continue
	}
}
if {$fail == 1} {
	winge "power on failed ... system not rebooted"
	list_systems
	exit 2
}

note "booting the system ..."
send "boot\r"
expect {
	default {
		winge "command prompt not issued"
		exit 2
	}
	-- "->" {
		#note "command prompt found"
	}
	"*E*" {
		warn "boot failed ..."
		set fail 1
		exp_continue
	}
}

note "complete ... exiting"
send "exit"
exit 0