From 2b7ae713e5edcc34f642b43783cd0ff191a62f32 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Mon, 23 Jun 2025 09:04:15 -0400 Subject: [PATCH] Improving starting.sh --- support/starting.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) 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() -- 2.47.3