adamdebreceni commented on code in PR #1726:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1726#discussion_r1490763055


##########
bin/minifi.sh:
##########
@@ -94,39 +105,93 @@ uninstall() {
     systemctl daemon-reload
 }
 
-check_service_installed() {
+check_service_installed_linux() {
     if [ ! -f "/usr/local/lib/systemd/system/minifi.service" ]; then
         echo "MiNiFi is not installed as a service. Please run 'minifi.sh 
install' first."
         exit 1
     fi
 }
 
+install() {
+    echo "Uninstalling any previous versions"
+    uninstall
+
+    detectOS
+    if [ "${darwin}" = "true"  ]; then
+      install_macos
+    else
+      install_linux
+    fi
+}
+
+uninstall() {
+    detectOS
+    if [ "${darwin}" = "true"  ]; then
+      uninstall_macos
+    else
+      uninstall_linux
+    fi
+}
+
+check_service_installed() {
+    detectOS
+    if [ "${darwin}" = "true"  ]; then
+      check_service_installed_macos
+    else
+      check_service_installed_linux
+    fi
+}
+
+start_service() {
+    check_service_installed
+    if [ "${darwin}" = "true"  ]; then
+      launchctl start org.apache.nifi.minifi
+    else
+      systemctl start minifi.service
+    fi
+    echo "MiNiFi started"
+}
+
+stop_service() {
+    check_service_installed
+    if [ "${darwin}" = "true"  ]; then
+      launchctl stop org.apache.nifi.minifi
+    else
+      systemctl stop minifi.service
+    fi
+    echo "MiNiFi stopped"
+}
+
+status_service() {
+    check_service_installed
+    if [ "${darwin}" = "true"  ]; then
+      launchctl list | grep org.apache.nifi.minifi
+    else
+      systemctl status minifi.service
+    fi
+}
+
 case "$1" in
     start)
-      check_service_installed
-      systemctl start minifi.service
-      echo "MiNiFi started"
+      start_service
       ;;
     stop)
-      check_service_installed
-      systemctl stop minifi.service
-      echo "MiNiFi stopped"
+      stop_service
       ;;
     run)
       exec "${minifi_executable}"
       ;;
     status)
-      check_service_installed
-      systemctl status minifi.service
+      status_service
       ;;
     restart)
-      check_service_installed
-      systemctl restart minifi.service
+      stop_service
+      start_service

Review Comment:
   restored 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to