refactor(utilities.sh): add logging to do_action_service function
- remove unused restart_nginx function Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -32,25 +32,25 @@ function check_euid(){
|
|||||||
#================================================#
|
#================================================#
|
||||||
|
|
||||||
function select_msg() {
|
function select_msg() {
|
||||||
echo -e "${white}>>>>>> $1"
|
echo -e "${white}>>>>>> ${1}"
|
||||||
}
|
|
||||||
function warn_msg(){
|
|
||||||
echo -e "${red}>>>>>> $1${white}"
|
|
||||||
}
|
}
|
||||||
function status_msg(){
|
function status_msg(){
|
||||||
echo; echo -e "${yellow}###### $1${white}"
|
echo -e "${yellow}###### ${1}${white}"
|
||||||
}
|
}
|
||||||
function ok_msg(){
|
function ok_msg(){
|
||||||
echo -e "${green}>>>>>> $1${white}"
|
echo -e "${green}>>>>>> ${1}${white}"
|
||||||
|
}
|
||||||
|
function warn_msg(){
|
||||||
|
echo -e "${yellow}>>>>>> ${1}${white}"
|
||||||
}
|
}
|
||||||
function error_msg(){
|
function error_msg(){
|
||||||
echo -e "${red}>>>>>> $1${white}"
|
echo -e "${red}>>>>>> ${1}${white}"
|
||||||
}
|
}
|
||||||
function abort_msg(){
|
function abort_msg(){
|
||||||
echo -e "${red}<<<<<< $1${white}"
|
echo -e "${red}<<<<<< ${1}${white}"
|
||||||
}
|
}
|
||||||
function title_msg(){
|
function title_msg(){
|
||||||
echo -e "${cyan}$1${white}"
|
echo -e "${cyan}${1}${white}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_error(){
|
function print_error(){
|
||||||
@@ -342,19 +342,17 @@ function do_action_service(){
|
|||||||
for service in ${services}; do
|
for service in ${services}; do
|
||||||
service=$(echo "${service}" | rev | cut -d"/" -f1 | rev)
|
service=$(echo "${service}" | rev | cut -d"/" -f1 | rev)
|
||||||
status_msg "${action^} ${service} ..."
|
status_msg "${action^} ${service} ..."
|
||||||
sudo systemctl "${action}" "${service}"
|
if sudo systemctl "${action}" "${service}"; then
|
||||||
ok_msg "OK!"
|
log_info "${service}: ${action} > success"
|
||||||
|
ok_msg "${action^} ${service} successfull!"
|
||||||
|
else
|
||||||
|
log_warning "${service}: ${action} > failed"
|
||||||
|
warn_msg "${action^} ${service} failed!"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function restart_nginx(){
|
|
||||||
if ls /lib/systemd/system/nginx.service 2>/dev/null 1>&2; then
|
|
||||||
status_msg "Restarting NGINX Service ..."
|
|
||||||
sudo systemctl restart nginx && ok_msg "NGINX Service restarted!"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#================================================#
|
#================================================#
|
||||||
#================ DEPENDENCIES ==================#
|
#================ DEPENDENCIES ==================#
|
||||||
#================================================#
|
#================================================#
|
||||||
|
|||||||
Reference in New Issue
Block a user