$ ls -l /opt/local/apache2/conf
bar.example.com.conf
foo.example.com.conf
httpd.conf@ -> bar.example.com.conf
$ sudo a2ensite foo.example.com
$ls -l /opt/local/apache2/conf
bar.example.com.conf
foo.example.com.conf
httpd.conf@ -> foo.example.com.conf
Last active
December 11, 2015 22:49
-
-
Save oh-sky/4672302 to your computer and use it in GitHub Desktop.
http.conf を、同階層の{domain.example.com}.conf へのソフトリンクにするスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CONFIG_DIR=/opt/local/apache2/conf/ | |
CONFIG_FILE=httpd.conf | |
SLINK_NAME="${CONFIG_DIR}${CONFIG_FILE}" | |
TARGET_NAME="${CONFIG_DIR}${1}.conf" | |
if [ -f $TARGET_NAME ] | |
then | |
echo $TARGET_NAME | |
if [ -f $SLINK_NAME ] | |
then | |
echo "removing ${SLINK_NAME} ..." | |
rm -f $SLINK_NAME | |
echo "ln -s ${TARGET_NAME} ${SLINK_NAME}" | |
ln -s $TARGET_NAME $SLINK_NAME | |
if [ $? -eq 0 ] ; then | |
echo "ok" | |
fi | |
fi | |
else | |
echo "err : ${TARGET_NAME} doesn't exist." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment