debian/bullseye
debian/jessie
|
Last change
on this file since bf1ddcd was 0662b2d, checked in by Joachim Langenbach <joachim.langenbach@…>, 9 years ago |
|
Improved webservice class to use TrackItem in ServiceData.php and added some tests
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Rev | Line | |
|---|
| [c455d7b] | 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | Copyright (C) 2016 - 2017 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 4 |
|
|---|
| 5 | This program is free software: you can redistribute it and/or modify
|
|---|
| 6 | it under the terms of the GNU General Public License as published by
|
|---|
| 7 | the Free Software Foundation, either version 3 of the License, or
|
|---|
| 8 | (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This program is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | GNU General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU General Public License
|
|---|
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | namespace GnuBoat;
|
|---|
| 20 |
|
|---|
| 21 | require_once(__DIR__ ."/../autoloader.php");
|
|---|
| 22 |
|
|---|
| 23 | class ServiceShutdown extends Service
|
|---|
| 24 | {
|
|---|
| 25 | function __construct()
|
|---|
| 26 | {
|
|---|
| 27 | parent::__construct();
|
|---|
| 28 | }
|
|---|
| [1ba85cf] | 29 |
|
|---|
| 30 | protected function process()
|
|---|
| [c455d7b] | 31 | {
|
|---|
| 32 | $debug = $this->debug();
|
|---|
| 33 | $config = new Config();
|
|---|
| 34 |
|
|---|
| 35 | $handle = @fopen($config->shutdownRequestFile(), "w");
|
|---|
| 36 | if($handle === false){
|
|---|
| 37 | $message = "Could not create file (". $config->shutdownRequestFile() .") to indicate shutdown to the daemon.";
|
|---|
| [0662b2d] | 38 | return $this->error($message, ["shutdownstart" => -1]);
|
|---|
| [c455d7b] | 39 | }
|
|---|
| 40 |
|
|---|
| [0662b2d] | 41 | $shutdownTime = new \DateTime('NOW');
|
|---|
| 42 | $shutdownTime->modify("+15 seconds");
|
|---|
| 43 | fwrite($handle, $shutdownTime->format(\DateTime::ATOM));
|
|---|
| 44 | fclose($handle);
|
|---|
| 45 | $result["shutdownstart"] = $shutdownTime->format(\DateTime::ATOM);
|
|---|
| 46 | $this->output($result);
|
|---|
| [c455d7b] | 47 | }
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | ?>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.