summaryrefslogtreecommitdiffstats
path: root/application/clicommands/DaemonCommand.php
blob: e89e1da89ab0596e8cdb39ccd25c137c7f2b84b8 (plain)
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
<?php

namespace Icinga\Module\Director\Clicommands;

use Icinga\Module\Director\Cli\Command;
use Icinga\Module\Director\Daemon\BackgroundDaemon;

class DaemonCommand extends Command
{
    /**
     * Run the main Director daemon
     *
     * USAGE
     *
     * icingacli director daemon run [--db-resource <name>]
     */
    public function runAction()
    {
        $this->app->getModuleManager()->loadEnabledModules();
        $daemon = new BackgroundDaemon();
        if ($dbResource = $this->params->get('db-resource')) {
            $daemon->setDbResourceName($dbResource);
        }
        $daemon->run();
    }
}