Files
bash-it/plugins/available/nginx.plugin.bash
Nils Winkler 98437efb15 Moved nginx settings to plugin.
These settings shouldn't be in the profile template, as they only make sense when used with nginx.
If you're using nginx, you can enable the nginx plugin.
2015-03-30 11:13:01 +00:00

70 lines
1.3 KiB
Bash

cite about-plugin
about-plugin 'manage your nginx service'
# Set the path nginx
export NGINX_PATH='/opt/nginx'
# Add nginx to the path
export PATH=$PATH:$NGINX_PATH/sbin
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
}
function nginx_stop() {
about 'stop nginx'
group 'nginx'
FILE="${NGINX_PATH}/logs/nginx.pid"
if [ -e $FILE ]; then
echo "Stopping NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -INT $PID
else
echo "Nginx pid file not found"
return 0
fi
}
function nginx_start() {
about 'start nginx'
group 'nginx'
FILE="${NGINX_PATH}/sbin/nginx"
if [ -e $FILE ]; then
echo "Starting NGINX..."
sudo $NGINX_PATH/sbin/nginx
else
echo "Couldn't start nginx"
fi
}
function nginx_restart() {
about 'restart nginx'
group 'nginx'
FILE="${NGINX_PATH}/logs/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
else
echo "Nginx pid file not found"
return 0
fi
}