Date: Fri, 03 Dec 1999 11:50:36 +0000 From: Richard Morte <ric@sinclairassoc.force9.co.uk> To: freebsd-questions <freebsd-questions@FreeBSD.ORG> Subject: Help with Perl script Message-ID: <3847AE8C.1FA003C1@sinclairassoc.force9.co.uk>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3847AE8C.1FA003C1>