cleaning up messaging related to 'service plc stop'
[myplc.git] / plc.d / functions
index 987a99d..29c5881 100644 (file)
@@ -78,7 +78,7 @@ plc_daemon ()
 # Print IP address of hostname if resolvable
 gethostbyname ()
 {
-    perl -MSocket -e '($a,$b,$c,$d,@addrs) = gethostbyname($ARGV[0]); print inet_ntoa($addrs[0]) . "\n";' $1 2>/dev/null
+    python -c 'import socket; import sys; print socket.gethostbyname(sys.argv[1])' $1 2>/dev/null
 }
 
 # Forcefully make a symlink
@@ -111,5 +111,5 @@ upper ()
 
 # Make copies of stdout and stderr. The plc initscript redirects
 # stdout and stderr to a logfile if -v is not specified.
-[ ! -e /dev/fd/3 ] && exec 3>&1
-[ ! -e /dev/fd/4 ] && exec 4>&2
+[ ! -e /proc/self/fd/3 ] && exec 3>&1
+[ ! -e /proc/self/fd/4 ] && exec 4>&2