gethostbyname written in python3
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 27 Feb 2020 14:47:17 +0000 (15:47 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 27 Feb 2020 14:47:17 +0000 (15:47 +0100)
plc.d/functions

index 340e89d..fa44a5c 100644 (file)
@@ -83,7 +83,8 @@ function plc_daemon () {
 
 # Print IP address of hostname if resolvable
 function gethostbyname () {
-    python -c 'import socket; import sys; print socket.gethostbyname(sys.argv[1])' $1 2>/dev/null
+    local host="$1"; shift
+    python3 -c "import socket; import sys; print(socket.gethostbyname('${host}'))"
 }
 
 # Forcefully make a symlink