Subversion Repositories qbpwcf-lib(archive)

Rev

Blame | Last modification | View Log | RSS feed

<?php

#使用命名空間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