trents_blog/docs/posts/xmpp-apt-notifications.md

1.6 KiB

title date draft tags authors
Xmpp Apt Notifications 2021-01-09 false
apt
apt-get
prosody
debian
trent

date: 2021-01-09

Introduction

In order to save yourself the work of checking your computer for updates, configure it to send you a weekly notification for updates using cron and sendxmpp.

Register an Xmpp User

ssh into your prosody server and use prosodyctl to create a user for your computer.

i.e. for your htpc:

# prosodyctl adduser htpc@example.com

You will be prompted to create a password.

Install sendxmpp

ssh into your computer and install sendxmpp.

i.e. for your htpc:

$ sudo apt-get install sendxmpp

Configure sendxmpp

ssh into your computer and login as the root user using

$ sudo su

write the following contents into /root/.sendxmpprc, i.e. for your htpc

htpc@example.com;example.com <password> 

secure your .sendxmpprc file by making it read-only, and only accessible by the root user

# chmod 600 /root/.sendxmpprc

Create Cron Job

While still logged in as root, open crontab for editing.

# crontab -e

And then write a command in crontab, i.e. for your htpc.

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
15 3 * * 4 apt-get update && apt-get -u upgrade --assume-no | sendxmpp -t -u htpc <yourself>@example.com

Receive Notifications on Android Device

Example Notification in Yaxim on Android

"Yaxim ScreenShot"{: .center }