#!/usr/bin/perl
use strict;
use warnings;
use RFC::Main;
use SemaforeFile;
my $user = $<;
if ($user != 0)
{
    print "must be root to run!\n";
    exit 0;
}
my @rigs = RFC::Main::get_rigs();
my $file = SemaforeFile->new('/usr/local/bin/celltest/start_servers');
exit unless ($file->exist);
my @lines = $file->readlines();
 OUTER:
    foreach my $r (@rigs)
{
    foreach my $l (@lines)
    {
	next OUTER if $l =~ /rig$r/;
    }
    my $str = "/bin/su - rig$r -s /bin/sh -c '/usr/local/bin/celltest/CGI-server $r > /dev/null 2> /dev/null &'";
    $file->append($str);
}

