AppserverIo\Appserver\Core\Scanner\AbstractScanner::restart PHP Method

restart() public method

Restart the appserver using the appserverctl file in the sbin folder.
public restart ( ) : void
return void
    public function restart()
    {
        // load the OS signature
        $os = php_uname('s');
        // log the found OS
        $this->getSystemLogger()->debug("Found operating system: {$os}");
        // check what OS we are running on
        switch ($os) {
            // If we got a Linux distribution we have to check which one
            case DeploymentScanner::LINUX:
                // Get the distribution
                $distribution = $this->getLinuxDistribution();
                // If we did not get anything
                if (!$distribution) {
                    // Log the error
                    $this->getSystemLogger()->error("The used Linux distribution could not be determined, it might not be supported.");
                    // End here
                    return;
                }
                // determine the version of the found distribution
                $distVersion = $this->getDistributionVersion($distribution);
                // log the found distribution
                $this->getSystemLogger()->debug("Found Linux distribution: {$distribution}");
                // Execute the restart command for the distribution
                exec($this->getRestartCommand($distribution . $os, $distVersion));
                break;
                // Restart with the Mac or Windows command
            // Restart with the Mac or Windows command
            case DeploymentScanner::DARWIN:
            case DeploymentScanner::WINDOWS_NT:
                exec($this->getRestartCommand($os));
                break;
                // all other OS are NOT supported actually
            // all other OS are NOT supported actually
            default:
                $this->getSystemLogger()->error("OS {$os} does not support auto restart");
                break;
        }
    }