]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improving starting.sh
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 23 Jun 2025 13:04:15 +0000 (09:04 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 23 Jun 2025 13:04:15 +0000 (09:04 -0400)
support/starting.sh

index 3619000088f92b909a4f670967908156f0566718..d23b558df589dcb7272deecc87ff87734c734844 100755 (executable)
@@ -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()