#!/usr/bin/perl
use CGI qw(param);

$home = "/usr/local/e-cron";
$jobnet = param("jobnet");
$project = param("project");
$change_status = param("change_status");
@server = param("server");

print "Content-type: text/html\n\n";
###############contents insert#########
system("cat ../elements/header");
print "&nbsp;&nbsp;&nbsp;<a href=\"./set_status_form.cgi?${project},${jobnet}\">Back to Enable/Disable operation</a>";
print "<br></br>";

# change status
print "<br></br>";
print "<pre>";

unless(@server){
  print "No server was cheked !";
  system("cat ../elements/footer");
  exit 1
}

if($change_status eq change_to_enable){

  foreach $server ( @server ) {
    system("sudo -u ejobmgr $home/bin/enable_jobnet $project/$jobnet $server");
  } 
}else{

  foreach $server ( @server ) {
    system("sudo -u ejobmgr $home/bin/disable_jobnet $project/$jobnet $server");
  } 
}
print "</pre>";
print "</div>";
system("cat ../elements/footer");

