Create the concept of enabled plugins
This allows users to disable a plugin without completely removing it. Instead, they simply remove the `plugins/enabled/*.bash` file for the plugin they want to disable. This continues the concept of "everything on" while providing greater flexibility to future users. It might be a good idea to allow turning these off by default in the future and allowing not only the `plugins/enabled/*.bash` files but also an array of `<plugin_name>` values that would search for `plugins/available/<plugin_name>.plugin.bash` to enable them. That method would make it easier for people custom tune their plugins from within their `.bash_profile` script.
This commit is contained in:
50
plugins/available/nginx.plugins.bash
Normal file
50
plugins/available/nginx.plugins.bash
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
function nginx_reload() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user