From owner-freebsd-questions Fri Dec 3 3:57:39 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cask.force9.net (cask.force9.net [195.166.128.29]) by hub.freebsd.org (Postfix) with SMTP id CA78114F1F for ; Fri, 3 Dec 1999 03:57:33 -0800 (PST) (envelope-from ric@sinclairassoc.force9.co.uk) Received: (qmail 22300 invoked from network); 3 Dec 1999 11:57:27 -0000 Received: from unknown (HELO sinclairassoc.force9.co.uk) (212.56.95.28) by cask.force9.net with SMTP; 3 Dec 1999 11:57:27 -0000 Message-ID: <3847AE8C.1FA003C1@sinclairassoc.force9.co.uk> Date: Fri, 03 Dec 1999 11:50:36 +0000 From: Richard Morte X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en-GB,en-US,en MIME-Version: 1.0 To: freebsd-questions Subject: Help with Perl script Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, I've successfully written a perl script as a front-end to swish-e in search mode. However, I'm out of luck in trying to get it to run in 'index' mode. The swish binary runs OK, (visible quite nicely in 'top') and valid parameters are being passed. I can even retrieve the verbose output whilst swish traverses and indexes the document tree, but it never creates the index file. Here's what I've tried... Attempt 1: system("$swish_bin -i \'$target\' -c \'$config\' -f \'$idx_file\' -l -v \'$verbose\' -S '$s_method\'") || local_errors(push (@errors, "600~Could not exec swish: $swish_bin: $!")); Attempt 2: exec $swish_bin,'-i',$target, '-c',$config, '-f',$idx_file, '-l', '-v',$verbose, '-S',$s_method; || local_errors(push (@errors, "600~Could not exec swish: $swish_bin: $!")); Attempt 3: $status = system($swish_bin,'-i',$target, '-c',$config, '-f',$idx_file, '-l', '-v',$verbose, '-S',$s_method); local_errors(push (@errors, "600~Could not exec swish: $swish_bin: $!")) unless $status == 0; (Note that the exit value ($status) is 65280. When in search mode a similar construct returns 0 - which is what I would have expected here...) Desperate (and somewhat useless) Attempt 4: open(SWISH, "$swish_bin -i $target -c $config -f $idx_file -l -v $verbose -S $s_method|") or (error-handler stuff, etc) FYI: $swish_bin is the absolute path and filename to the swish executable $target is the document directory tree (absolute path) $config is an absolute path and filename to a configuration file $idx_file is the index file to create (but never gets created), again abs path and filename $verbose determines the volume of messages to STDOUT during indexing (0-3) $s_method is either 'fs' or 'http' None of the attempts produce errors - it's as though the indexing takes place in hyperspace and never touches the hard disk. I've been through the O'Reilley Perl books, but cannot see what I'm doing wrong. The direction I'm heading in is to run a process that will create the index file, then figure out a way for the script not to have to wait until the process completes (processing 1000's of files can take hours) (Attempt 2 does this already, Attempt 3 will do this if I direct output to /dev/null?), and finally figure out a way to see how the process ended to see if indexing is successful. Apologies for an off-topic posting, but I'm completely stuck. Thanks to anyone who can help! Ric To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message