Improvements on nginx plugin. Fixed nginx_reload and added NGINX_PID_PATH variable.
- Modify nginx_reload function to use the correct "-s reload" attribute on nginx executable. - Add NGINX_PID_PATH variable on bash_profile.template.bash to allow users to provide pid files on any directory, not just on $NGINX_PATH/logs/. - Modify nginx_restart to call nginx_stop and nginx_start - Add path information on pid not found error.pull/164/head
parent
ea5ec1d8bd
commit
f4df920309
|
|
@ -5,28 +5,21 @@ function nginx_reload() {
|
||||||
about 'reload your nginx config'
|
about 'reload your nginx config'
|
||||||
group 'nginx'
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
echo "Reloading NGINX..."
|
||||||
if [ -e $FILE ]; then
|
sudo $NGINX_PATH/nginx -s reload
|
||||||
echo "Reloading NGINX..."
|
|
||||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
|
||||||
sudo kill -HUP $PID
|
|
||||||
else
|
|
||||||
echo "Nginx pid file not found"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function nginx_stop() {
|
function nginx_stop() {
|
||||||
about 'stop nginx'
|
about 'stop nginx'
|
||||||
group 'nginx'
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
FILE="${NGINX_PID_PATH}/nginx.pid"
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
echo "Stopping NGINX..."
|
echo "Stopping NGINX..."
|
||||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
PID=`cat $NGINX_PID_PATH/nginx.pid`
|
||||||
sudo kill -INT $PID
|
sudo kill -INT $PID
|
||||||
else
|
else
|
||||||
echo "Nginx pid file not found"
|
echo "Nginx pid file not found at: ${FILE}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -35,10 +28,10 @@ function nginx_start() {
|
||||||
about 'start nginx'
|
about 'start nginx'
|
||||||
group 'nginx'
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/sbin/nginx"
|
FILE="${NGINX_PATH}/nginx"
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
echo "Starting NGINX..."
|
echo "Starting NGINX..."
|
||||||
sudo $NGINX_PATH/sbin/nginx
|
sudo $NGINX_PATH/nginx
|
||||||
else
|
else
|
||||||
echo "Couldn't start nginx"
|
echo "Couldn't start nginx"
|
||||||
fi
|
fi
|
||||||
|
|
@ -48,16 +41,13 @@ function nginx_restart() {
|
||||||
about 'restart nginx'
|
about 'restart nginx'
|
||||||
group 'nginx'
|
group 'nginx'
|
||||||
|
|
||||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
FILE="${NGINX_PID_PATH}/nginx.pid"
|
||||||
if [ -e $FILE ]; then
|
if [ -e $FILE ]; then
|
||||||
echo "Stopping NGINX..."
|
nginx_stop
|
||||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
nginx_start
|
||||||
sudo kill -INT $PID
|
echo "Done!"
|
||||||
sleep 1
|
|
||||||
echo "Starting NGINX..."
|
|
||||||
sudo $NGINX_PATH/sbin/nginx
|
|
||||||
else
|
else
|
||||||
echo "Nginx pid file not found"
|
echo "Nginx pid file not found at: ${FILE}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,12 @@ export BASH_IT_THEME='bobby'
|
||||||
export GIT_HOSTING='git@git.domain.com'
|
export GIT_HOSTING='git@git.domain.com'
|
||||||
|
|
||||||
# Set my editor and git editor
|
# Set my editor and git editor
|
||||||
export EDITOR="/usr/bin/mate -w"
|
export EDITOR='/usr/bin/mate -w'
|
||||||
export GIT_EDITOR='/usr/bin/mate -w'
|
export GIT_EDITOR='/usr/bin/mate -w'
|
||||||
|
|
||||||
# Set the path nginx
|
# Set the path nginx
|
||||||
export NGINX_PATH='/opt/nginx'
|
export NGINX_PATH='/opt/nginx/sbin'
|
||||||
|
export NGINX_PID_PATH=${NGINX_PATH}'/logs'
|
||||||
|
|
||||||
# Don't check mail when opening terminal.
|
# Don't check mail when opening terminal.
|
||||||
unset MAILCHECK
|
unset MAILCHECK
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue