Scripting Question
John Westcott IV
John.Westcott at tufts.edu
Wed Jul 12 14:00:16 EDT 2006
I am working on modifying the apachectl script and I am pretty sure I am
getting messed up by sh.
I modified a variable to include a -c when starting apache:
HTTPD_ARGS="-d $AHOME -f conf/httpd.conf -D${USER} -c\"PidFile
$PIDFILE\""
Later on I echo the full command I want to start apache with
echo $HTTPD $HTTPD_ARGS -DSSL;
The script outputs:
/usr/local/apache/bin/httpd -d /home/<username>/current -f
conf/httpd.conf -D<username> -c"PidFile
/home/<username>/current/logs/httpd.pid" -DSSL
(where <username> is the correct name of the user (and contains
only alphanumeric data))
This output is correct and copying and pasting it into a shell starts
apache successfully.
However if inside the script I call:
$HTTPD $HTTPD_ARGS -DSSL; (same as the echo above)
It gives me an error message:
Syntax error in -C/-c directive:
PidFile takes one argument, A file for logging the server process ID
I've also tried:
`echo $HTTPD $HTTPD_ARGS -DSSL;` within the script and I get the
same failure message.
I think it has something to do with sh not using the quotes right in the
HTTPD_ARGS variable and I am, unfortunately, not that proficient with SH.
I have tried every combination of quoting and escaping that I can think of.
Any help would be much appreciated.
Thanks,
John
More information about the Discuss
mailing list