Install earlyoom at gce instance startup

This commit is contained in:
Michael Vines
2018-09-08 10:38:32 -07:00
parent 9f413fd656
commit 9f5c86e60c
8 changed files with 127 additions and 79 deletions

View File

@ -0,0 +1,21 @@
#!/bin/bash -ex
# Prevent background upgrades that block |apt-get|
#
# TODO: This approach is pretty uncompromising. An alternative solution that
# doesn't involve deleting system files would be welcome.
[[ $(uname) = Linux ]] || exit 1
[[ $USER = root ]] || exit 1
rm -rf /usr/lib/apt/apt.systemd.daily
rm -rf /usr/bin/unattended-upgrade
killall apt.systemd.daily || true
killall unattended-upgrade || true
while fuser /var/lib/dpkg/lock; do
echo Waiting for lock release...
sleep 1
done