Skip to content

Instantly share code, notes, and snippets.

@octaflop
Created December 3, 2010 00:04
Show Gist options
  • Save octaflop/726349 to your computer and use it in GitHub Desktop.
Save octaflop/726349 to your computer and use it in GitHub Desktop.
A quick-and-dirty python script to send a message using lib-notify to multiple machines.
# -*- encoding:utf-8 -*-
# notify.py
# a simple wrapper to notify a user
import subprocess, os
user = 'guest'
# I named the computers after south park characters :D
clients = ['cartman', 'kyle', 'stan', 'kenny']
title = raw_input("title?\n")
text = raw_input("text?\n")
# Image comes with default ubuntu 10.10 installs.
image = "/usr/share/icons/Humanity/categories/48/applications-science.svg"
command = "DISPLAY=:0 notify-send '%s' '%s' -i '%s'" % (title, text, image)
# Send a message to each client
for client in clients:
subprocess.call(['ssh', '-X', "%s@%s.local" % (user, client), command])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment