mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers: in ynh_systemd_action, check the actual timestamp when checking for timeout, because for some reason journalctl may take a ridiculous amount of time to run
This commit is contained in:
parent
7c1c147a74
commit
f3eef43d02
1 changed files with 9 additions and 0 deletions
|
@ -128,6 +128,7 @@ ynh_systemd_action() {
|
|||
if [[ -n "${line_match:-}" ]]; then
|
||||
set +x
|
||||
local i=0
|
||||
local starttime=$(date +%s)
|
||||
for i in $(seq 1 $timeout); do
|
||||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||
if [ "$log_path" == "systemd" ]; then
|
||||
|
@ -145,6 +146,14 @@ ynh_systemd_action() {
|
|||
if [ $i -eq 30 ]; then
|
||||
echo "(this may take some time)" >&2
|
||||
fi
|
||||
# Also check the timeout using actual timestamp, because sometimes for some reason,
|
||||
# journalctl may take a huge time to run, and we end up waiting literally an entire hour
|
||||
# instead of 5 min ...
|
||||
if [[ "$(( $(date +%s) - $starttime))" -gt "$timeout" ]]
|
||||
then
|
||||
i=$timeout
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
set -x
|
||||
|
|
Loading…
Add table
Reference in a new issue