Reputation: 7563
I have a lot of filenames in my Sphinx config with name like /home/ubuntu/sites/sitename.dev/data/sphinx/searchd.pid
with same path prefix.
Can I separate path /home/ubuntu/sites/sitename.dev/data/sphinx/
from that filename into variable to use it like $path/searchd.pid
?
Upvotes: 1
Views: 814
Reputation: 21091
Its a little known feature, but the config file can actully be a script - such as PHP, perl or even plain old bash. Just uses a classic shebang line - if the first line begins with #! that intpreter is used to execute the script, and the output used as the conf file.
Example for PHP..
#!/usr/bin/php
<?php
$path = "/home/ubuntu/sites/sitename.dev/";
?>
searchd {
pid_file = <?php echo $path; ?>/searchd.pid
}
As a side note why are you having multiple pid files? Surely its best to have one single pid file - ie one single instance of searchd. A single instance can serve many indexes. You can use this scripting capablity, to keep seperate 'files' for each index (for easy of use) - which the script consolidates into one file for use.
Upvotes: 4