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

Re: Server unresponsive question ?



[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.
-- 
 PGP signed and encrypted  |  .''`.  ** Debian GNU/Linux **
    messages preferred.    | : :' :      The  universal
                           | `. `'      Operating System
 http://www.palfrader.org/ |   `-    http://www.debian.org/