#
# UNIXFORK : Forking ELZA for Unix platforms
#
# Usage
#
#	perl unixfork.pl NUMBER COMMANDFILE
#
# This script will fork NUMBER instances of elza, each running COMMANDFILE
#

# Set those according to your setup

$PathToPerl = '/usr/bin/perl';
$PathToElza = '/mnt/dos/elza/elza.pl';

# ======================================================================
# NO CHANGES BELOW THIS LINE ARE NECESSARY

for $Counter (1..$ARGV[0]) {
	&forkelza($Counter);
}

sub forkelza {

	my $instance = shift;
	my $pid = fork();
	
	if ($pid == 0) {
		return;
	} else {
		system("$PathToPerl $PathToElza $ARGV[1] $instance $ARGV[0]");
		exit;
	}
}
