]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Shell: put the process in background only for up, start and restart actions
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 11 Jun 2018 18:32:30 +0000 (15:32 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 11 Jun 2018 18:32:30 +0000 (15:32 -0300)
kvmx

diff --git a/kvmx b/kvmx
index 9650d012c8206d63ae35f9287fa6fbe57114fe2d..abe063a63abc3658bc22546d83673ea5dd2875f9 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -1736,20 +1736,28 @@ function kvmx_shell {
           echo "Running in restricted shell mode."
           echo "Allowed commands are only `echo $restricted_actions | tr ':' ' '`"
         else
-          # Process command, nohup version, stdout and stderr are redirected to a file
+          if [ "${STDIN[0]}" == "up" ] || [ "${STDIN[0]}" == "start" ] || [ "${STDIN[0]}" == "restart" ]; then
+            # Process command, nohup version, stdout and stderr are redirected to a file
+            #nohup $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
+
+            # Process command, disown version, stdout are preserved
+            $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} &
+            disown -h
+          else
+            $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
+          fi
+        fi
+      else
+        if [ "${STDIN[0]}" == "up" ] || [ "${STDIN[0]}" == "start" ] || [ "${STDIN[0]}" == "restart" ]; then
+          # Process command, nohup version
           #nohup $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
 
-          # Process command, disown version, stdout are preserved
+          # Process command, disown version
           $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} &
           disown -h
+        else
+          $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
         fi
-      else
-        # Process command, nohup version
-        #nohup $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
-
-        # Process command, disown version
-        $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} &
-        disown -h
       fi
     fi
   done