mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
add sendnotifications and update checker cron
Signed-off-by: szaimen <szaimen@e.mail.de> Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
c8e8c27925
commit
a46a36ee41
4 changed files with 77 additions and 1 deletions
|
|
@ -367,6 +367,51 @@ class DockerActionManager
|
|||
}
|
||||
}
|
||||
|
||||
public function sendNotification(Container $container, string $subject, string $message)
|
||||
{
|
||||
if ($this->GetContainerStartingState($container) instanceof RunningState) {
|
||||
|
||||
$containerName = $container->GetIdentifier();
|
||||
|
||||
// schedule the exec
|
||||
$url = $this->BuildApiUrl(sprintf('/containers/%s/exec', urlencode($containerName)));
|
||||
$response = json_decode(
|
||||
$this->guzzleClient->request(
|
||||
'POST',
|
||||
$url,
|
||||
[
|
||||
'json' => [
|
||||
'AttachStdout' => true,
|
||||
'Tty' => true,
|
||||
'Cmd' => [
|
||||
'bash',
|
||||
'/notify.sh',
|
||||
$subject,
|
||||
$message
|
||||
],
|
||||
],
|
||||
]
|
||||
)->getBody()->getContents()
|
||||
);
|
||||
|
||||
// get the id from the response
|
||||
$id = $response['Id'];
|
||||
|
||||
// start the exec
|
||||
$url = $this->BuildApiUrl(sprintf('/exec/%s/start', $id));
|
||||
$this->guzzleClient->request(
|
||||
'POST',
|
||||
$url,
|
||||
[
|
||||
'json' => [
|
||||
'Detach' => false,
|
||||
'Tty' => true,
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function DisconnectContainerFromNetwork(Container $container)
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue