Subversion Repositories php-qbpwcf

Rev

Rev 11 | Rev 226 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2014~2025 Min-Jhin,Chen

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/

#使用命名空間qbpwcf
namespace qbpwcf;

#assets dir
$assetsDir="assets of cmd::register_20241125";

#函式說明:
#將要執行的程式變成透過 systemd 來運行.
#回傳結果:
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
#$result["error"],錯誤訊息.
#$result["function"],當前執行的函式名稱.
#$result["argu"],所使用的參數.
#$result["content"],執行的結果.
#必填參數:
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
$conf["fileArgu"]=__FILE__;
#$conf["name"],字串,服務名稱,實際產生的system名稱會加上".service".
$conf["name"]="cmd::registerService:20241125";
#$conf["cmd"],要執行的指令與參數,字串陣列.
$conf["cmd"]="dmesg";
#可省略參數:
#$conf["params"],字串陣列,要使用的參數.
$conf["params"]=array("-T");
#$conf["enable"],字串,預設為"true",代表該服務為enable.
$conf["enable"]="true";
#$conf["startNow"],字串,預設為"true",代表該服務要立刻舉辦.
$conf["startNow"]="true";
#參考資料:
#無.
#備註:
#無.
$registerService=cmd::registerService($conf);
unset($conf);

#如果執行失敗
if($registerService["status"]==="false"){

        #debug
        var_dump($registerService);

        }#if end