From b61d3e4f8333851bfc9ca319378e74478d103e7a Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 24 Dec 2014 21:24:47 +0000 Subject: [PATCH] Created fn_messages --- functions/fn_messages | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 functions/fn_messages diff --git a/functions/fn_messages b/functions/fn_messages new file mode 100644 index 000000000..503047a64 --- /dev/null +++ b/functions/fn_messages @@ -0,0 +1,54 @@ +#!/bin/bash +# LGSM fn_messages function +# Author: Daniel Gibbs +# Website: http://danielgibbs.co.uk +# Version: 241214 +# +# Description: Defines on-screen messages such as and now script logs look + +# Displays date and servicename for log files +fn_scriptlog(){ + echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${1}" >> "${scriptlog}" +} + +# [ FAIL ] +fn_printfail(){ + echo -en "\r\033[K[\e[0;31m FAIL \e[0;39m] $@" +} + +fn_printfailnl(){ + echo -e "\r\033[K[\e[0;31m FAIL \e[0;39m] $@" +} + +# [ OK ] +fn_printok(){ + echo -en "\r\033[K[\e[0;32m OK \e[0;39m] $@" +} + +fn_printoknl(){ + echo -e "\r\033[K[\e[0;32m OK \e[0;39m] $@" +} + +# [ INFO ] +fn_printinfo(){ + echo -en "\r\033[K[\e[0;36m INFO \e[0;39m] $@" +} + +fn_printinfonl(){ + echo -e "\r\033[K[\e[0;36m INFO \e[0;39m] $@" +} + +# [ WARN ] +fn_printwarn(){ + echo -en "\r\033[K[\e[1;33m WARN \e[0;39m] $@" +} + +fn_printwarnnl(){ + echo -e "\r\033[K[\e[1;33m WARN \e[0;39m] $@" +} + +# [ .... ] +fn_printdots(){ + echo -en "\r\033[K[ .... ] $@" +} +