Skip to content

Instantly share code, notes, and snippets.

@joaocgreis
Last active March 29, 2025 11:19
Show Gist options
  • Save joaocgreis/1d77a9a5d45184a11430293f31af9d98 to your computer and use it in GitHub Desktop.
Save joaocgreis/1d77a9a5d45184a11430293f31af9d98 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
# curl -L 'https://gist.githubusercontent.com/joaocgreis/1d77a9a5d45184a11430293f31af9d98/raw/rc.local' -o /etc/rc.local
# sudo chmod 755 /etc/rc.local
# sudo chown root:root /etc/rc.local
sleep 8
export DEBIAN_FRONTEND=noninteractive
ping -4 -c 1 -w 1 www.google.com && (for try in `seq 49 -1 0`; do
echo && echo === APT === &&
apt-get -y update &&
apt-get -d -y dist-upgrade &&
apt-get -y dist-upgrade &&
apt-get -y autoremove &&
apt-get -y clean &&
echo && echo === SNAP === &&
snap refresh &&
echo && echo === DONE === &&
echo && break
ps aux | grep -i -e python -e unattended -e dpkg -e apt
echo === $try retries left...
sleep 1
done) || true
[ -e /var/run/reboot-required ] && reboot || echo === No reboot needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment