Skip to content

Instantly share code, notes, and snippets.

@xorenio
Last active January 31, 2018 12:54
Show Gist options
  • Save xorenio/404d77cb332f785f3029d9e1d6b2ecec to your computer and use it in GitHub Desktop.
Save xorenio/404d77cb332f785f3029d9e1d6b2ecec to your computer and use it in GitHub Desktop.
Debian or Ubuntu update or reboot
#!/bin/bash
UPDATES=$(LANG=C apt-get upgrade -s |grep -P '^\d+ upgraded'|cut -d" " -f1);
if [ $UPDATES -lt 0 ]; then
reboot
else
echo "yay you finally updated";
fi
exit 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment