Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple Minecraft server notifier using lsof and ssmtp to check for active player conections and send an email if players have logged in to the server since the last check.
#!/bin/bash
email="user@domain.com"
message="Someone has logged in to the Minecraft server"
if [ -s .players ]; then
lsof -iTCP:25565 -sTCP:ESTABLISHED > .players
else
lsof -iTCP:25565 -sTCP:ESTABLISHED > .players && echo "$message" | /usr/sbin/ssmtp "$email"
fi
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.