mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add another trick to autorestart yunohost-api at the end of the upgrade when ran from the api itself...
This commit is contained in:
parent
933603ae1e
commit
6f640c08a6
2 changed files with 19 additions and 1 deletions
2
debian/control
vendored
2
debian/control
vendored
|
@ -27,7 +27,7 @@ Depends: ${python3:Depends}, ${misc:Depends}
|
||||||
, rspamd, opendkim-tools, postsrsd, procmail, mailutils
|
, rspamd, opendkim-tools, postsrsd, procmail, mailutils
|
||||||
, redis-server
|
, redis-server
|
||||||
, acl
|
, acl
|
||||||
, git, curl, wget, cron, unzip, jq, bc, at
|
, git, curl, wget, cron, unzip, jq, bc, at, procps
|
||||||
, lsb-release, haveged, fake-hwclock, equivs, lsof, whois
|
, lsb-release, haveged, fake-hwclock, equivs, lsof, whois
|
||||||
Recommends: yunohost-admin
|
Recommends: yunohost-admin
|
||||||
, ntp, inetutils-ping | iputils-ping
|
, ntp, inetutils-ping | iputils-ping
|
||||||
|
|
18
debian/postinst
vendored
18
debian/postinst
vendored
|
@ -38,6 +38,24 @@ do_configure() {
|
||||||
systemctl restart yunohost-api
|
systemctl restart yunohost-api
|
||||||
else
|
else
|
||||||
echo "(Delaying the restart of yunohost-api, this should automatically happen after the end of this upgrade)"
|
echo "(Delaying the restart of yunohost-api, this should automatically happen after the end of this upgrade)"
|
||||||
|
cat << EOF | at -M now >/dev/null 2>&1
|
||||||
|
# Wait for apt / dpkg / yunohost to not be up anymore, hence the upgrade finished
|
||||||
|
|
||||||
|
while pgrep -x apt || pgrep -x apt-get || pgrep dpkg || test -e /var/run/moulinette_yunohost.lock;
|
||||||
|
do
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
|
||||||
|
# Restart yunohost-api, though only if it wasnt already restarted by something else in the last 60 secs
|
||||||
|
|
||||||
|
API_START_TIMESTAMP="\$(date --date="\$(systemctl show yunohost-api | grep ExecMainStartTimestamp= | awk -F= '{print \$2}')" +%s)"
|
||||||
|
|
||||||
|
if [ "\$(( \$(date +%s) - \$API_START_TIMESTAMP ))" -ge 60 ];
|
||||||
|
then
|
||||||
|
echo "restart" >> /var/log/testalex
|
||||||
|
systemctl restart yunohost-api
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue