I am terribly sorry but i posted wrong version (one from clipboard not actually right one so again). You can edit what you want (eg hashing or anything else). I don't know how to stop it from init.d script gracefully (for now I have there kill -9 pid). I thing the problem is in the loop (while /bin/true). #!/bin/sh #verze 2.0.0_2013-05-31 lock=/var/run/hostnames-updater.pid shmm="/dev/shm/hosts" clean () { rm $lock rm $shmm } trap clean SIGHUP SIGINT SIGTERM /bin/echo $$ > $lock while /bin/true do tst(){ x=0 if /usr/bin/test $3 = $(/usr/bin/ssh-keyscan -p $2 $5 2>/dev/null|/bin/sed 's/.*\ ssh-.*\ //g'|/usr/bin/whirlpooldeep) then x=$5 elif /usr/bin/test $1 -gt 2 then if /usr/bin/test $3 = $(/usr/bin/ssh-keyscan -p $2 $6 2>/dev/null|/bin/sed 's/.*\ ssh-.*\ //g'|/usr/bin/whirlpooldeep) then x=$6 else x=$4 fi else x=$4 fi } ####################host1 tst
... 2>&1 >/dev/null host1=$x ####################AJA /bin/echo "# /etc/hosts: Local Host Database # # This file describes a number of aliases-to-address mappings for the for # local hosts that share this file. # # In the presence of the domain name service or NIS, this file may not be # consulted at all; see /etc/host.conf for the resolution order. # # IPv4 and IPv6 localhost aliases 127.0.0.1 $(hostname).local $(hostname) localhost ::1 localhost # # Imaginary network. $host1 hostname1 # Last update $(date --rfc-3339=ns) # # # According to RFC 1918, you can use the following IP networks for private # nets which will never be connected to the Internet: # # 10.0.0.0 - 10.255.255.255 # 172.16.0.0 - 172.31.255.255 # 192.168.0.0 - 192.168.255.255 # # In case you want to be able to connect directly to the Internet (i.e. not # behind a NAT, ADSL router, etc...), you need real official assigned # numbers. Do not try to invent your own network numbers but instead get one # from your network provider (if any) or from your regional registry (ARIN, # APNIC, LACNIC, RIPE NCC, or AfriNIC.) # " > $shmm /bin/mv $shmm /etc/hosts /usr/bin/sleep 120 done