I keep getting this error, do you guys know what is wrong?
rapache is an alias for restart apache
mugbear:/usr/bin# cat /usr/bin/mkdomain
if [ -d "/srv/www/$1" ]; then
echo "Domain $1 already exists!"
else
mkdir -p /srv/www/$1/public_html
mkdir -p /srv/www/$1/logs
cat >> /etc/apache2/sites-available/"$1" << EOF
<VirtualHost removed:80>
ServerAdmin support@$1
ServerName $1
ServerAlias www.$1
DocumentRoot /srv/www/$1/public_html/
ErrorLog /srv/www/$1/logs/error.log
CustomLog /srv/www/$1/logs/access.log combined
</VirtualHost>
EOF
a2ensite $1
rapache
fi
mugbear:/usr/bin# mkdomain test.com
/usr/bin/mkdomain: line 19: syntax error: unexpected end of file
From serverfault
Doug
-
Your heredoc never ends since the terminator is not at the beginning of the line.
Doug : I don't see a terminator in the other answer: http://serverfault.com/questions/196557/how-can-i-make-this-script-better Could you show me me an example? Also, I cannot seem to find a manual on EOF.Ignacio Vazquez-Abrams : The `EOF` must be the only thing on the line. No spaces before, and none after. And you want to find a manual for `<<`, not `EOF`.Doug : Ahh. I see, it looks weird without the indentation, but it works. Thakns!Ignacio Vazquez-Abrams : Generally heredocs are not indented. It's understood that they're not really part of the script.
0 comments:
Post a Comment