Last active
October 23, 2023 20:49
-
-
Save PJUllrich/e95baa0d718e55a6c67f85cd8e53dabe to your computer and use it in GitHub Desktop.
Bash script to send your IP via Pushover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IP=`hostname -I | awk '{print $1}'` | |
MESSAGE="Pi ${HOSTNAME} fully booted. New IP: $IP" | |
TITLE="`whoami`@${HOSTNAME}" | |
APP_TOKEN="YOUR_APP_TOKEN_HERE" | |
USER_TOKEN="YOUR_USER_TOKEN_HERE" | |
wget https://api.pushover.net/1/messages.json --post-data="token=$APP_TOKEN&user=$USER_TOKEN&message=$MESSAGE&title=$TITLE" -qO- > /dev/null 2>&1 & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this to send the IP of my Raspberry Pi via Pushover to my phone so that I can connect via SSH to it.
To implement this, you have to do the following.
/home/YOUR_HOSTNAME/pushover.sh
sudo chmod 755 /home/YOUR_HOSTNAME/pushover.sh
/home/YOUR_HOSTNAME/./pushover.sh
sudo nano /etc/systemd/system/pushover-ip.service
sudo nano /etc/sysctl.d/local.conf
net.ipv6.conf.all.disable_ipv6=1
sudo systemctl enable systemd-networkd-wait-online.service
sudo systemctl enable pushover-ip.service
sudo shutdown -r now