From 06c763d862b1971bc9b44a6aa68924cf5f9d7ff0 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Tue, 2 May 2023 13:12:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0run=5Fdaemon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Help/shell/run_daemon.sh | 50 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/Help/shell/run_daemon.sh b/Help/shell/run_daemon.sh index 080bd4b..04971e2 100644 --- a/Help/shell/run_daemon.sh +++ b/Help/shell/run_daemon.sh @@ -1,4 +1,30 @@ #/bin/bash +# 狗头 +echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' +echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@`***,@@@@@@@@' +echo '@@@@^*****,\@@@@@@@@@@@@@@@@@@@@`*.....*\@@@@@@' +echo '@@@@*.......**\@[`***......*****.....*..*\@@@@@' +echo '@@@@^*..............................***...@@@@@' +echo '@@@@@*...............................**..*\@@@@' +echo '@@@@@^*..*............................*..*=@@@@' +echo '@@@@@^**................................**=@@@@' +echo '@@@@@/*..................................*=@@@@' +echo '@@@@@*..... ..... ............*@@@@' +echo '@@@@`*. .]]]]` ... ]/[[[O/O]`........*,@@@' +echo '@@@@*.=` =O.,OO......=` .OOOOOO^........*@@@' +echo '@@@^*.\ =OOOOO^.....=` .OOOOOO^........*=@@' +echo '@@@^*..,\].=OO/.........,[\]]O/[` ......*=@@' +echo '@@@@*...................... .*@@@' +echo '@@@@`. ......,]]...... .,@@@' +echo '@@@@@*. OOOOOOO^ .*@@@@' +echo '@@@@@\*. \OOOO` .*/@@@@' +echo '@@@@@@\*. =. / .*/@@@@@' +echo '@@@@@@@@`*. ,\OOOOOOO]]OO` .*,@@@@@@@' +echo '@@@@@@@@@@`*. . .*,@@@@@@@@@' +echo '@@@@@@@@@@@@\**.. ......... ..**/@@@@@@@@@@@' +echo '@@@@@@@@@@@@@@@@]`***......***,]@@@@@@@@@@@@@@@' +echo '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' + # 使 UEngine 能在 Wayland 下运行 export XDG_SESSION_TYPE=x11 export QT_QPA_PLATFORM=xcb @@ -14,9 +40,31 @@ unset WAYLAND_DISPLAYCOPY XDG_CURRENT_DESKTOP="Deepin" export LD_LIBRARY_PATH=/usr/share/uengine/lib64/ # 判断 UEngine 是否被正确安装 +which uengine +if [[ $? != 0 ]]; then + notify-send -i /opt/apps/com.gitee.uengine.runner.spark/files/icon.png "未安装 UEngine,结束!" -a uengine-runner + exit +fi notify-send -i /opt/apps/com.gitee.uengine.runner.spark/files/icon.png "UEngine 服务启动完成" -a uengine-runner +bad=0 # 守护进程,防止异常退出 while [[ true ]]; do uengine session-manager -platformtheme=deepin - notify-send -i /opt/apps/com.gitee.uengine.runner.spark/files/icon.png "UEngine 服务异常结束,重新启动" -a uengine-runner + # 让用户可以强制结束 + if [[ -f "/tmp/uengine-loading-ubuntu-end" ]]; then + rm /tmp/uengine-loading-ubuntu-end + echo UEngine 服务异常崩溃,不再重启服务 + notify-send -i /opt/apps/com.gitee.uengine.runner.spark/files/icon.png "UEngine 服务异常崩溃,不再重启服务" -a uengine-runner + exit + fi + if [[ $bad -gt 9 ]]; then + # 错误次数太多,结束 + notify-send -i /opt/apps/com.gitee.uengine.runner.spark/files/icon.png "UEngine 服务异常崩溃次数过多,不再重启服务" -a uengine-runner + echo UEngine 服务异常崩溃次数过多,不再重启服务 + exit + fi + bad=$(($bad+1)) + echo "UEngine 服务异常结束,重新启动($bad次)" + notify-send -i /opt/apps/com.gitee.uengine.runner.spark/files/icon.png "UEngine 服务异常结束,重新启动($bad次)" -a uengine-runner + done \ No newline at end of file