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'
|
||||
group 'nginx'
|
||||
|
||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Reloading NGINX..."
|
||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
||||
sudo kill -HUP $PID
|
||||
else
|
||||
echo "Nginx pid file not found"
|
||||
return 0
|
||||
fi
|
||||
echo "Reloading NGINX..."
|
||||
sudo $NGINX_PATH/nginx -s reload
|
||||
}
|
||||
|
||||
function nginx_stop() {
|
||||
about 'stop nginx'
|
||||
group 'nginx'
|
||||
|
||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||
FILE="${NGINX_PID_PATH}/nginx.pid"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Stopping NGINX..."
|
||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
||||
PID=`cat $NGINX_PID_PATH/nginx.pid`
|
||||
sudo kill -INT $PID
|
||||
else
|
||||
echo "Nginx pid file not found"
|
||||
echo "Nginx pid file not found at: ${FILE}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
|
@ -35,10 +28,10 @@ function nginx_start() {
|
|||
about 'start nginx'
|
||||
group 'nginx'
|
||||
|
||||
FILE="${NGINX_PATH}/sbin/nginx"
|
||||
FILE="${NGINX_PATH}/nginx"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Starting NGINX..."
|
||||
sudo $NGINX_PATH/sbin/nginx
|
||||
sudo $NGINX_PATH/nginx
|
||||
else
|
||||
echo "Couldn't start nginx"
|
||||
fi
|
||||
|
|
@ -48,16 +41,13 @@ function nginx_restart() {
|
|||
about 'restart nginx'
|
||||
group 'nginx'
|
||||
|
||||
FILE="${NGINX_PATH}/logs/nginx.pid"
|
||||
FILE="${NGINX_PID_PATH}/nginx.pid"
|
||||
if [ -e $FILE ]; then
|
||||
echo "Stopping NGINX..."
|
||||
PID=`cat $NGINX_PATH/logs/nginx.pid`
|
||||
sudo kill -INT $PID
|
||||
sleep 1
|
||||
echo "Starting NGINX..."
|
||||
sudo $NGINX_PATH/sbin/nginx
|
||||
nginx_stop
|
||||
nginx_start
|
||||
echo "Done!"
|
||||
else
|
||||
echo "Nginx pid file not found"
|
||||
echo "Nginx pid file not found at: ${FILE}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,11 +17,12 @@ export BASH_IT_THEME='bobby'
|
|||
export GIT_HOSTING='git@git.domain.com'
|
||||
|
||||
# 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'
|
||||
|
||||
# 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.
|
||||
unset MAILCHECK
|
||||
|
|
|
|||
Loading…
Reference in New Issue