$thresholdMinutes * 60) { echo "$containerName has been idle for over $thresholdMinutes minutes. Stopping...\n"; try { // Check if the container exists and stop it if it does if ($lxdService->containerExists($containerName)) { $lxdService->stopContainer($containerName); echo "Stopped container: $containerName\n"; } else { echo "Container $containerName does not exist.\n"; } } catch (Throwable $e) { echo "Error stopping $containerName: " . $e->getMessage() . "\n"; } } }