]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Try a new approach for disown at kvmx-shell
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 15 Jun 2018 00:10:01 +0000 (21:10 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 15 Jun 2018 00:10:01 +0000 (21:10 -0300)
kvmx

diff --git a/kvmx b/kvmx
index 9fb7788bebd6cb2adfbba5346191ebee5431e34b..b5bf449902aafc7e7fd9699c0383155215dcdbbe 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -1795,7 +1795,12 @@ function kvmx_shell {
         else
           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} < /dev/null >> $LOG_DIR/nohup 2>&1 &
+            #nohup $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} < /dev/null >> $LOG_DIR/nohup 2>&1 &
+
+            # Process command, disown version, stdout are preserved
+            #$APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} &
+            $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} < /dev/null >> $LOG_DIR/nohup 2>&1 &
+            disown -h
 
             sleep 1
             if [ -e "$LOG_DIR/nohup" ] && [ -z "$tail" ]; then
@@ -1803,10 +1808,6 @@ function kvmx_shell {
               tail="$1"
             fi
             sleep 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
@@ -1814,12 +1815,19 @@ function kvmx_shell {
       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} < /dev/null >> $LOG_DIR/nohup 2>&1 &
-          tail -F $LOG_DIR/nohup &
+          #nohup $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} < /dev/null >> $LOG_DIR/nohup 2>&1 &
 
           # Process command, disown version
           #$APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} &
-          #disown -h
+          $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} < /dev/null >> $LOG_DIR/nohup 2>&1 &
+          disown -h
+
+          sleep 1
+          if [ -e "$LOG_DIR/nohup" ] && [ -z "$tail" ]; then
+            tail -F $LOG_DIR/nohup &
+            tail="$1"
+          fi
+          sleep 1
         else
           $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1}
         fi
@@ -1829,7 +1837,7 @@ function kvmx_shell {
 
   if [ ! -z "$tail" ]; then
     kill $tail &> /dev/null
-    rm -f $LOG_DIR/nohup
+    #rm -f $LOG_DIR/nohup
   fi
 }