From b74ef5e5ae32e37272b4135e04eb4e1ffd3fe994 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 29 Jun 2011 08:27:45 -0400
Subject: [PATCH] First commit for: FS#952 - Module for virtual machine management
---
server/cron_daily.php | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 8ea4395..2d12f2c 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -394,6 +394,27 @@
}
+
+#######################################################################################################
+// deactivate virtual servers (run only on the "master-server")
+#######################################################################################################
+
+if ($app->dbmaster == $app->db) {
+ $current_date = date('Y-m-d');
+
+ //* Check which virtual machines have to be deactivated
+ $sql = "SELECT * FROM openvz_vm WHERE active = 'y' AND active_until_date != '0000-00-00' AND active_until_date < '$current_date'";
+ $records = $app->db->queryAllRecords($sql);
+ if(is_array($records)) {
+ foreach($records as $rec) {
+ $app->dbmaster->datalogUpdate('openvz_vm', "active = 'n'", 'vm_id', $rec['vm_id']);
+ $app->log('Virtual machine active date expired. Disabling VM '.$rec['veid'],LOGLEVEL_DEBUG);
+ }
+ }
+
+
+}
+
#######################################################################################################
// Create website backups
#######################################################################################################
--
Gitblit v1.9.1