skiqqy.xyz/nginxd

35 lines
534 B
Plaintext
Raw Normal View History

2020-10-14 21:28:25 +00:00
#!/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