Skip to content

Instantly share code, notes, and snippets.

@womd
Last active February 23, 2024 14:51
Show Gist options
  • Select an option

  • Save womd/8f6933731cd6a6e67297d41b7507bf9e to your computer and use it in GitHub Desktop.

Select an option

Save womd/8f6933731cd6a6e67297d41b7507bf9e to your computer and use it in GitHub Desktop.
linux install cheatsheet - things i need every now and then
#required for host command
sudo apt-get install bind9-host -y
# update IP to KeyValue-Store
# ! chmod +x !
#/opt/updateIP.sh:
#!/bin/sh
IP=$(host myip.opendns.com resolver1.opendns.com | tail -n1 | awk '{ print $4 ; exit }')
echo "ip is: ${IP}"
#IPSTR=$(echo "$IP" | sed 's/\.//g')
IPSTR=$(echo "$IP" | sed 's/\./x/g')
#replace XXXXXXX with app-key
curl -X POST http://keyvalue.immanuel.co/api/KeyVal/UpdateValue/XXXXXXXX/tip/${IPSTR} -H 'content-length: 0'
#-----------
Systemd - Service / Timer für updateIp.sh
#-----------
/etc/systemd/system/updateip.service
[Unit]
Description=Update kv store with ip
[Service]
Type=simple
ExecStart=/opt/updateIp.sh
[Install]
WantedBy=default.target
#------------
/etc/systemd/system/updateip.timer
[Unit]
Description=update ip in kv store
RefuseManualStart=no
RefuseManualStop=no
[Timer]
Persistent=false
OnBootSec=200
OnUnitActiveSec=3600
#File describing job to execute
Unit=updateip.service
[Install]
WantedBy=timers.target
#-------------
# Timer aktivieren:
systemctl daemon-reload
systemctl enable updateip.timer
#-----------------
# SSHD - enable Public-Key-Auth
/etc/ssh/sshd_config
PubkeyAuthentication yes
PasswordAuthentication no
#--------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment