diff options
| author | Silvio Rhatto <rhatto@riseup.net> | 2018-06-14 21:10:01 -0300 | 
|---|---|---|
| committer | Silvio Rhatto <rhatto@riseup.net> | 2018-06-14 21:10:01 -0300 | 
| commit | 85b75902e8866076844e41b6c9406f94bf54305f (patch) | |
| tree | 7bdc6b7a755d1ddad446eb2a5d944be39c919b82 | |
| parent | 688ab1325cbd58edf0d89f845b9d356e0536bd24 (diff) | |
| download | kvmx-85b75902e8866076844e41b6c9406f94bf54305f.tar.gz kvmx-85b75902e8866076844e41b6c9406f94bf54305f.tar.bz2  | |
Try a new approach for disown at kvmx-shell
| -rwxr-xr-x | kvmx | 26 | 
1 files changed, 17 insertions, 9 deletions
@@ -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  }  | 
