From: Jean-Marc Pigeon (Delson) Date: Mon, 23 Jun 2025 13:04:15 +0000 (-0400) Subject: Improving starting.sh X-Git-Tag: tag-0.9~18 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=2b7ae713e5edcc34f642b43783cd0ff191a62f32;p=jmp%2Fmailleur Improving starting.sh --- diff --git a/support/starting.sh b/support/starting.sh index 3619000..d23b558 100755 --- a/support/starting.sh +++ b/support/starting.sh @@ -7,6 +7,29 @@ OS=$1 #set the OS Type #Hard coded variables export APPNAME=mailleur #=============================================================== +#restarting a daemon +#---------------------------------------------------------------------- +#$1 daemon application name +sh_restart() + +{ +case "$OS" in + osukiss ) + service $1 restart + ;; + sysvinit ) + service $1 restart + ;; + systemd ) + systemctl restart $1 + ;; + * ) + echo "sh_restart: Unexpected OS=$OS, exiting!" + exit 1 + ;; + esac +} +#---------------------------------------------------------------------- #reporting a big trouble #---------------------------------------------------------------------- sh_failure() @@ -29,6 +52,48 @@ case "$OS" in esac } #---------------------------------------------------------------------- +#reporting a small problem +sh_warning() + +{ +case "$OS" in + osukiss ) + echo Warning: $1 + ;; + sysvinit ) + echo Warning: $1 + ;; + systemd ) + echo -n $2 ; warning; + ;; + * ) + echo "sh_warning: Unexpected OS=$OS, exiting!" + exit 1 + ;; + esac +} +#---------------------------------------------------------------------- +#reporting a success +sh_success() + +{ +case "$OS" in + osukiss ) + echo Success: $1 + ;; + sysvinit ) + echo Success: $1 + ;; + systemd ) + echo -n $1 ; success; + ;; + * ) + echo "sh_warning: Unexpected OS=$OS, exiting!" + exit 1 + ;; + esac +} +#---------------------------------------------------------------------- #procedure to check if the config is properly done #---------------------------------------------------------------------- chk_config()