FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Restarting a Server from a Web Application

 


NewGuyinTown
Does anyone know how to implement a php web application that restart a service (my JBOSS server)? If so, how would I do it? Any advices/help appreciated.
MrBlueSky
You can execute any shell-command from PHP, both on Windows and Linux. You can use system() to do this.

Code:

<?php

if (system('some shell command', $status)) {
    // check return code
    if ($status == 0) {
        // oke
    } else {
        // error: do something
    }
} else {
    // error: could not execute command
}

?>


You only have to find out the proper shell command to restart the JBoss server and, if available, what status codes it returns on success and failure.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.