Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to select custom log location. #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions virtualhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ fi
usage()
{
cat << __EOT
Usage: sudo virtualhost.sh <name> [<optional path>]
Usage: sudo virtualhost.sh <name> [<optional path>] [<optional log-path>]
sudo virtualhost.sh --list
sudo virtualhost.sh --delete <name>
where <name> is the one-word name you'd like to use. (e.g. mysite)
Expand Down Expand Up @@ -498,6 +498,7 @@ else
else
VIRTUALHOST=`echo $1|sed -e 's/\///g'`
FOLDER=`echo $2 | sed -e 's/\/*$//'`
LOG_FOLDER=`echo $3 | sed -e 's/\/*$//'`
fi
fi

Expand Down Expand Up @@ -836,8 +837,10 @@ if checkyesno ${PROMPT_FOR_LOGS}; then
case $resp in

y*|Y*)
log="1"
LOG_FOLDER="$FOLDER/logs"
log="1"
if [ -z "$LOG_FOLDER" ]; then
LOG_FOLDER="$FOLDER/logs"
fi
;;

*)
Expand All @@ -848,7 +851,9 @@ if checkyesno ${PROMPT_FOR_LOGS}; then
elif checkyesno ${ALWAYS_CREATE_LOGS}; then

log="1"

if [ -z "$LOG_FOLDER" ]; then
LOG_FOLDER="$FOLDER/logs"
fi
fi


Expand Down Expand Up @@ -897,6 +902,19 @@ if checkyesno ${CREATE_INDEX}; then
</table>
</p>

<p>You will find yout logs in:<br>
<table class="indent" border="0" cellspacing="3">
<tr>
<td><img src="/icons/script.gif" width="20" height="22" border="0"></td>
<td><b><a href="file://$LOG_FOLDER/access_log-$VIRTUALHOST">$LOG_FOLDER/access_log-$VIRTUALHOST</b></a></td>
</tr>
<tr>
<td><img src="/icons/script.gif" width="20" height="22" border="0"></td>
<td><b><a href="file://$LOG_FOLDER/error_log-$VIRTUALHOST">$LOG_FOLDER/error_log-$VIRTUALHOST</b></a></td>
</tr>
</table>
</p>

<p>For the latest version of this script, tips, comments, <span style="font-size: 10px; color: #999999;">donations,</span> etc. visit:<br>
<table class="indent" border="0" cellspacing="3">
<tr>
Expand Down