[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Server unresponsive question ?



Peter Palfrader wrote:
[Dustin, please try to trim what you're quoting]
On Tue, 11 Oct 2005, Dustin Eward wrote:


I wish it would read from a seperate file so that I could run a script that just grep/awk-ed the IP from whatismyip.com (wget whatismyip.com | grep foo | awk -F bar '{print $x}' > /etc/?torip?), checked for changes, and would automaticaly "/etc/init.d/tor restart" if the IP was ever different, and also change the IP in such scenario... I could write it to rewrite the whole torrc file each time, but that's anoying and dirty...


You mean like your torrc file?  :)

cd /etc/tor
grep -v '^Address' torrc > torrc.in

now every so often:
  cd /etc/tor
  wget whatismyip.com | grep foo | awk -F bar '{print $x}' > torIP  # or what your heart desires to get your IP
  if [ "`cat torIP`" != "`cat torIP.running`" ] ; then
	  (cat torrc.in; echo -n "Address "; cat torIP) > torrc
	  /etc/init.d/tor reload
	  cat torIP > torIP.running
  fi

You also most likely want reload instead of restart.


Not tested or anything, but it ought to work something like this or similar.

Thanks Peter! This seems to be a nice way to keep servers reachable. Will try it tommorrow.


cu
Olli