diff options
-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 } |