summaryrefslogtreecommitdiffstats
path: root/apis/init.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-10-09 16:01:11 +0200
committerSimon Rettberg2014-10-09 16:01:11 +0200
commite1dc0d3c99217504de2ac8467156274786efc0bd (patch)
tree130d7fed1fff8aaaffe5942cf2a3d6bb1dad03c8 /apis/init.inc.php
parentMinor fixes and improvements (diff)
downloadslx-admin-e1dc0d3c99217504de2ac8467156274786efc0bd.tar.gz
slx-admin-e1dc0d3c99217504de2ac8467156274786efc0bd.tar.xz
slx-admin-e1dc0d3c99217504de2ac8467156274786efc0bd.zip
Big load of changes
- Added callback functionality for taskmanager tasks. You can launch a task and define a callback function to be run when the task finished. This requires activating the cronjob - Added cron functionality: Add cronjob that calls the cron api every 5 minutes to use it. (See cron.inc.php) - Added eventlog - Added missing translations - Merged main-menu-login and main-menu-logout
Diffstat (limited to 'apis/init.inc.php')
-rw-r--r--apis/init.inc.php61
1 files changed, 4 insertions, 57 deletions
diff --git a/apis/init.inc.php b/apis/init.inc.php
index a1344fc4..617114d7 100644
--- a/apis/init.inc.php
+++ b/apis/init.inc.php
@@ -1,62 +1,9 @@
<?php
+// via cron:
+// @reboot www-data php /path/to/api.php init
+
if (!isLocalExecution())
exit(0);
-EventLog::info('System boot...');
-$everythingFine = true;
-
-DefaultData::populate();
-
-// Tasks: fire away
-$mountId = Trigger::mount();
-$ldadpId = Trigger::ldadp();
-$autoIp = Trigger::autoUpdateServerIp();
-$ipxeId = Trigger::ipxe();
-
-// Check status of all tasks
-// Mount vm store
-if ($mountId === false) {
- EventLog::info('No VM store type defined.');
- $everythingFine = false;
-} else {
- $res = Taskmanager::waitComplete($mountId, 5000);
- if (Taskmanager::isFailed($res)) {
- EventLog::failure('Mounting VM store failed: ' . $res['data']['messages']);
- $everythingFine = false;
- }
-}
-// LDAP AD Proxy
-if ($ldadpId === false) {
- EventLog::failure('Cannot start LDAP-AD-Proxy: Taskmanager unreachable!');
- $everythingFine = false;
-} else {
- $res = Taskmanager::waitComplete($ldadpId, 5000);
- if (Taskmanager::isFailed($res)) {
- EventLog::failure('Starting LDAP-AD-Proxy failed: ' . $res['data']['messages']);
- $everythingFine = false;
- }
-}
-// Primary IP address
-if (!$autoIp) {
- EventLog::failure("The server's IP address could not be determined automatically, and there is no active address configured.");
- $everythingFine = false;
-}
-// iPXE generation
-if ($ipxeId === false) {
- EventLog::failure('Cannot generate PXE menu: Taskmanager unreachable!');
- $everythingFine = false;
-} else {
- $res = Taskmanager::waitComplete($ipxeId, 5000);
- if (Taskmanager::isFailed($res)) {
- EventLog::failure('Update PXE Menu failed: ' . $res['data']['error']);
- $everythingFine = false;
- }
-}
-
-// Just so we know booting is done (and we don't expect any more errors from booting up)
-if ($everythingFine) {
- EventLog::info('Bootup finished without errors.');
-} else {
- EventLog::info('There were errors during bootup. Maybe the server is not fully configured yet.');
-}
+Event::systemBooted();