Changeset - f0c4f1476771
[Not reviewed]
default
0 1 0
virii - 11 years ago 2013-12-18 20:58:42
virii@enn.lu
multiple instances now fully supported
1 file changed with 12 insertions and 7 deletions:
0 comments (0 inline, 0 general)
Scripts/update_server.pl
Show inline comments
 
@@ -10,16 +10,21 @@ by virii
 
use HTTP::Tiny;
 
use IO::Socket;
 
######## [defaults] ########
 
$data_dir = '/var/lib/tor';
 
$pidfile  = '/var/run/tor/tor.pid';
 
######## [ennstatus URL] ########
 
open ennstatus, "<", "/etc/ennstatus_updater.conf" || die "Ennstatus config file not found!\n";
 
@configs = qw(torrc torrc2);					 # every config file! like: torrc torrc0 torrc1 
 
$data_dir = '/var/lib/tor';					 # default data dir
 
$pidfile  = '/var/run/tor/tor.pid';				 # default pid file
 
$API_url = 'http://enn.lu';					 # will be ignored if /etc/ennstatus_updater.conf is present
 
######## [ennstatus URL - config file] ######
 
if (-e '/etc/ennstatus_updater.conf') {
 
	open ennstatus, "<", "/etc/ennstatus_updater.conf" || die "Cannot open 'ennstatus_updater.conf'!\n";
 
    while (<ennstatus>) {
 
        $ennstatus_url = $1 if /^ennstatus_url = (.+)/i;
 
    }
 
close ennstatus;
 
} else {
 
	$ennstatus_url = $API_url;
 
}
 
######## [loop through configs] ########
 
@configs = qw(torrc);                                                   # every config file! like: torrc torrc0 torrc1 
 
for (1..scalar @configs) {
 
    open config, "<", "/etc/tor/" . $configs[$_ -1] || die "Cannot open $configs[$_ -1]\n";
 
        while (<config>) {
 
@@ -58,8 +63,6 @@ for (1..scalar @configs) {
 
    } else {
 
        $tor_status = 'Offline';
 
    }
 
######## [end of loop] ########
 
}
 
######## [create json string] ########    
 
if ($server_type eq "Bridge") {
 
$json_string = '{"fingerprint": "' . $fingerprint .
 
@@ -86,4 +89,6 @@ if ($server_type eq "Bridge") {
 
                                    );
 

	
 
print $request->{content};
 
######## [end of loop] ########
 
}
 

	
0 comments (0 inline, 0 general)