script to magically restart tor [was: Re: disappearing nodes]

ssc at server1.h07.org ssc at server1.h07.org
Wed Apr 6 19:21:54 UTC 2005


On Wed, Apr 06, 2005 at 02:09:16PM -0400, Roger Dingledine wrote:
> We currently exit(0) when we're obsolete. I don't believe we exit with
> that status code anywhere else, except if you sigint or sigterm tor.
> 
> So perhaps scripts like this should check the status code and only
> restart if there was a problem? Can somebody volunteer to sort this out
> and provide a recommended script we can put in tor/contrib/?

That's pretty trivial:

---BEGIN SCRIPT---
#!/usr/bin/perl
while( sleep 1 ) {
        my $ReturnCode = system( '/usr/local/bin/tor -f /etc/torrc' );
        last unless $ReturnCode;
}
---END SCRIPT---

But you could just use this command:
perl -e "while(sleep 1){\$r=system('tor -f /etc/torrc');last unless \$r;}"
        
-- 
Ewige Blumenkraft!         )|( ssc                    www.unix-geek.info
                               Stephan Schmieder             ssc at h07.org

safeguard this letter, it may be an IMPORTANT DOCUMENT
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.torproject.org/pipermail/tor-talk/attachments/20050406/031110a7/attachment.pgp>


More information about the tor-talk mailing list