-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseraphp.php
More file actions
49 lines (49 loc) · 1.4 KB
/
seraphp.php
File metadata and controls
49 lines (49 loc) · 1.4 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env php5
<?php
/**
* Example startup file for Seraphp server
* @package Seraphp
*/
require_once 'Server/ServerManager.class.php';
$cf = \Seraphp\Server\Config\ConfigFactory::getInstance();
if ($argc > 1) {
if (isset($argv[2])) {
$server = $argv[2];
} else {
$server = 'main';
}
if (isset($argv[3])) {
$cf->setXmlSrc($argv[3]);
} else {
$cf->setXmlSrc('./seraphpConf.xml');
}
switch ($argv[1]) {
case 'start':
\Seraphp\Server\ServerManager::startup($server);
break;
case 'stop':
\Seraphp\Server\ServerManager::shutdown($server);
break;
case 'restart':
\Seraphp\Server\ServerManager::restart($server);
break;
default: echo '1st paramter has to be the required action:'.
'start|stop|restart';
break;
}
} else {
echo "Usage: ./seraphp.php ACTION SERVER [config]\n";
echo "\n";
echo "Available ACTIONS:\n";
echo "start\t\t\tStarts a server\n";
echo "stop\t\t\tStops a server\n";
echo "restart\t\t\tRestart a server\n";
echo "\n";
echo "Available SERVERs:\n";
echo "See your config file.\n";
echo "\n";
echo "Config(optional):\n";
echo "An XML file containing the configuration for the servers you want to";
echo " instatiate.\n";
echo "Must be valid against seraphpConf.xsd!\n";
}