This is actually surprisingly simple. You’ll need inotify-tools and sendxmpp. In Debian-based distributions, just install the two packages:
bash# apt-get install inotify-tools sendxmpp
Next, you’ll want to set your username, server, and password in
~/.sendxmpprc since you probably don’t want to put those on the command line and have them show up in the process list. The sendxmpprc file is very simple, just add the following line (note that service is optional, but may be required for sendxmpp to work with some servers):
email@example.com password service
And make sure to replace user, domain, and password with appropriate values.
Now, let’s say you wanted to be notified of any changes to your home directory. All you’d have to do is issue the following command:
inotifywait -mr /home/username | sendxmpp -ti firstname.lastname@example.org
-m switch tells inotify not to exit after an event is received. The
-r switch tells it to monitor recursively. The
-t switch tells sendxmpp to log in securely with TLS. You may need to use
-e instead if your server only supports SSL.
-i tells sendxmpp to send messages interactively (i.e., it sends line by line from
That’s all there is to it. Check out the man pages for inotifywait and sendxmpp for more fun options.