From: Silvio Rhatto Date: Fri, 15 Jun 2018 00:10:01 +0000 (-0300) Subject: Try a new approach for disown at kvmx-shell X-Git-Tag: 0.1.0~207 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=85b75902e8866076844e41b6c9406f94bf54305f;p=kvmx.git Try a new approach for disown at kvmx-shell --- diff --git a/kvmx b/kvmx index 9fb7788..b5bf449 100755 --- 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 }