ispman/bin ispman.executeTask,NONE,1.1

Atif Ghaffar <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/bin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28067

Added Files:
	ispman.executeTask 
Log Message:
Task executor

--- NEW FILE: ispman.executeTask ---
#!/usr/bin/perl
BEGIN {
    use FindBin;
    unshift @INC,( $FindBin::Bin, "$FindBin::Bin/../lib", "$FindBin::Bin/../conf" );
}

$VERBOSE=1;
$NOEXEC=1;

$|++;

my $task=shift @ARGV;

$task_func=join "_", ($task, "task");
$task_dir=$FindBin::Bin . "/../tasks/";
$task_file="$task_dir/$task_func\.pl";

die "Task dir: $task_dir does not exists" unless (-d $task_dir);
die "Task file: $task_file does not exists" unless (-e $task_file);

do $task_file;
&{$task_func}(@ARGV);


## function called by the task scripts
sub executeCommands{
    my @commands=@_;
    foreach $command(@commands) {
        if ($VERBOSE) {
            print "Command: $command\n";
        }
        unless ($NOEXEC){
            system($command);
        }
    }
}






-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.