skiqqy.xyz/nginxd
2020-10-14 23:28:25 +02:00

35 lines
534 B
Bash
Executable File

#!/bin/bash
# @Auther skiqqy
# This script allows me to enable/disable certain sections of my website.
help_menu () {
echo "Welcome!"
echo -e "e\t->\tEnable a unit."
echo -e "d\t->\tDisable a unit."
echo -e "h\t->\tShows this message."
}
error () {
echo "[ERROR] $1"
exit $2
}
while getopts "he:d:" opt
do
case $opt in
h)
help_menu
;;
e | d)
[ ! -z $unit ] && error "Unit <$unit> already set" 1
[[ $opt == "e" ]] && oper=e || oper=d
unit="$OPTARG"
;;
*)
exit 2
;;
esac
done
echo $unit, $oper