mirror of
https://github.com/skiqqy/skiqqy.github.io
synced 2025-02-09 08:06:54 +00:00
Good progress on nginxd
This commit is contained in:
parent
66c130ff26
commit
364cc3122a
18
nginxd
18
nginxd
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# @Auther skiqqy
|
# @Auther skiqqy
|
||||||
|
# This script is best run as root inside the root of this repo.
|
||||||
# This script allows me to enable/disable certain sections of my website.
|
# This script allows me to enable/disable certain sections of my website.
|
||||||
|
|
||||||
help_menu () {
|
help_menu () {
|
||||||
@ -10,10 +11,18 @@ help_menu () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
error () {
|
error () {
|
||||||
|
# error [message] [exit code]
|
||||||
echo "[ERROR] $1"
|
echo "[ERROR] $1"
|
||||||
exit $2
|
exit $2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
link () {
|
||||||
|
# links available site to enabled.
|
||||||
|
# link [unit]
|
||||||
|
[ ! -f /etc/nginx/sites-available/$1 ] && error "The unit <$1> file cannot be linked" 1
|
||||||
|
ln -s /etc/nginx/sites-available/$1 /etc/nginx/sites-enabled/$1
|
||||||
|
}
|
||||||
|
|
||||||
while getopts "he:d:" opt
|
while getopts "he:d:" opt
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
@ -21,7 +30,7 @@ do
|
|||||||
help_menu
|
help_menu
|
||||||
;;
|
;;
|
||||||
e | d)
|
e | d)
|
||||||
[ ! -z $unit ] && error "Unit <$unit> already set" 1
|
[ ! -z $unit ] && error "Unit <$unit> already set." 1
|
||||||
[[ $opt == "e" ]] && oper=e || oper=d
|
[[ $opt == "e" ]] && oper=e || oper=d
|
||||||
unit="$OPTARG"
|
unit="$OPTARG"
|
||||||
;;
|
;;
|
||||||
@ -31,4 +40,9 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $unit, $oper
|
# Available units
|
||||||
|
units=( git blog wiki irc proj all )
|
||||||
|
|
||||||
|
# Check that a valid unit was given.
|
||||||
|
[[ ! " ${units[@]} " =~ " ${unit} " ]] && error "The unit <$unit> does not exist." 1 \
|
||||||
|
|| echo "Unit <$unit> found!"
|
||||||
|
Loading…
Reference in New Issue
Block a user