Rev 466 | Rev 883 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/php<?php/*QBPWCF, Quick Build PHP website Component base on Fedora Linux.Copyright (C) 2015~2024 Min-Jhin,ChenThis file is part of QBPWCF.QBPWCF is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with QBPWCF. If not, see <http://www.gnu.org/licenses/>.*//*安裝方式:將該檔案移動到 /usr/bin/ 底下描述:確認 mariabdb 有在運作*/#使用命名空間qbpwcfnamespace qbpwcf;#以該檔案的實際位置的 lib path 為 include path 首位exec("cd ".pathinfo(__FILE__)["dirname"]."/../../;pwd;",$output,$status);set_include_path($output[0].PATH_SEPARATOR.get_include_path());#匯入外部套件include("allInOne.php");#無窮迴圈while(true){#查詢服務啟動沒#涵式說明:#執行 systemd 程序來管理服務.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息.#$result["function"],當前執行的函數名稱.#$result["argu"],所使用的參數.#$result["content"],執行的結果.#$result["content"]["srerviceInfo"]["on"],"true",代表運行中,"false",代表無運行.#$result["content"]["srerviceInfo"]["auto"],"true",代表自動啟動,"false",代表不自動啟動.#必填參數:#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#$conf["name"],字串,服務名稱.$conf["name"]="mariadb";#可省略參數:#$conf["operation"],字串,"enable","disable","start","stop","restart",預設為"list".$conf["operation"]="status";#$conf["username"],字串,要用什麼使用者來執行,預設為root使用者#$conf["username"]="";#$conf["password"],字串,使用者的密碼,預設不使用.#$conf["password"]="";$systemd=cmd::systemd($conf);unset($conf);#若運行出錯if($systemd["status"]==="false"){#debugvar_dump($systemd);#停止執行exit;}#if end#如果服務沒啟動if($systemd["content"]["srerviceInfo"]["on"]==="false"){#啟動服務#涵式說明:#執行 systemd 程序來管理服務.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息.#$result["function"],當前執行的函數名稱.#$result["argu"],所使用的參數.#$result["content"],執行的結果.#$result["content"]["srerviceInfo"]["on"],"true",代表運行中,"false",代表無運行.#$result["content"]["srerviceInfo"]["auto"],"true",代表自動啟動,"false",代表不自動啟動.#必填參數:#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#$conf["name"],字串,服務名稱.$conf["name"]="mariadb";#可省略參數:#$conf["operation"],字串,"enable","disable","start","stop","restart",預設為"list".$conf["operation"]="start";#$conf["username"],字串,要用什麼使用者來執行,預設為root使用者#$conf["username"]="";#$conf["password"],字串,使用者的密碼,預設不使用.#$conf["password"]="";$systemd=cmd::systemd($conf);unset($conf);#若運行出錯if($systemd["status"]==="false"){#debugvar_dump($systemd);#停止執行exit;}#if end}#if end#過30秒再檢查一次sleep(30);#下一輪continue;}#while end?>