summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
blob: 789552cdb9c6c44cbb0f7966bf3ac557e2c5bf8e (plain) (blame)
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
<?php

class RebootControl
{

	/**
	 * @param string[] $uuids List of machineuuids to reboot
	 * @return false|array task struct for the reboot job
	 */
	public static function reboot($uuids)
	{
		$list = RebootQueries::getMachinesByUuid($uuids);
		if (empty($list))
			return false;
		return self::execute($list, false, 0, 0);
	}

	public static function execute($list, $shutdown, $minutes, $locationId)
	{
		return Taskmanager::submit("RemoteReboot", array(
			"clients" => $list,
			"shutdown" => $shutdown,
			"minutes" => $minutes,
			"locationId" => $locationId,
			"sshkey" => SSHKey::getPrivateKey(),
			"port" => 9922, // Hard-coded, must match mgmt-sshd module
		));
	}

}