add ldap-hostname script and service
Deploy Package / Explore-Gitea-Actions (push) Successful in 14s

This commit is contained in:
Carneiro committed 2024-11-18 10:32:21 -03:00
1 parent 60f506b2c7
commit 0a77bc0003
2 files changed
+21

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
IP=$(hostname -I | awk '{print $1}')
HOSTNAME=$(getent hosts | grep $IP | awk '{print $2}')
if [ -n "$HOSTNAME" ]; then
hostnamectl set-hostname "$HOSTNAME"
echo "Hostname set to $HOSTNAME"
else
echo "Hostname not found for IP $IP"
fi