Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Email notifications and one click install for Ubuntu package updates. http://stephennancekivell.blogspot.com/2013/06/server-updates-automate-it-part-2.html
#!/bin/bash
MSG=`sudo apt-get --yes dist-upgrade`
MSG_HEADING='sudo apt-get --yes dist-upgrade'
GmailSend.py -u bla@gmail.com -p bla -t bla@gmail.com -s "server update" -b "$MSG_HEADING \n\n $MSG"
#!/bin/bash
sudo apt-get update > /dev/null
M=`sudo apt-get --download-only --yes dist-upgrade`
MSG_HEADING='sudo apt-get --download-only --yes dist-upgrade'
LINK='http://myserver.com/bla/doTheUpgrade/dontGuessMe'
if echo $M | grep 'The following packages will be upgraded' > /dev/null
then
# these is upgrade
GmailSend.py -u bla@gmail.com -p bla -t bla@gmail.com -s "server update" -b "$MSG_HEADING \n\n $M \n\n $LINK"
fi
#!/usr/bin/env python
from flask import Flask
import os
app = Flask(__name__)
@app.route("/doTheUpgrade/dontGuessMe")
def hello():
os.system("sh ./do_update.sh")
return "performing update"
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.