#!/usr/bin/perl -w #---------------------------------------------------------------------- # copyright (C) 1999-2005 Mitel Networks Corporation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #---------------------------------------------------------------------- package esmith; use strict; use Errno; use File::Find; use esmith::util; use esmith::templates; use esmith::ConfigDB; my $event = shift || die "must give event name parameter"; chdir "/etc/e-smith/events/$event" or die "Couldn't chdir to event directory /etc/e-smith/events/$event: $!"; my $serviceName = shift || die "serviceName argument missing"; my $serviceAction = shift || die "Action argument missing"; my $configdb = esmith::ConfigDB->open_ro(); my $serv = $configdb->get($serviceName) or die "Couldn't find $serviceName record in config db\n"; my $status=$serv->prop('status'); if ($serviceName =~ /^([-\@\w.]+)$/) { $serviceName = $1; # $data now untainted } else { die "Bad data in '$serviceName'"; # log this somewhere } esmith::util::serviceControl( NAME=>$serviceName, ACTION=>$serviceAction,BACKGROUND=>'false' );