aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx18
1 files changed, 15 insertions, 3 deletions
diff --git a/kvmx b/kvmx
index 8de8d23..6386e7c 100755
--- a/kvmx
+++ b/kvmx
@@ -1772,6 +1772,7 @@ function kvmx_version {
# Shell
function kvmx_shell {
+ local tail=""
local restricted="$1"
local restricted_actions=":status:start:stop:poweroff:suspend:resume:console:monitor"
restricted_actions="$restricted_actions:wipe:shred:app_base:version:list_image:kill:"
@@ -1794,8 +1795,14 @@ 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} >> $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 &
+
+ sleep 1
+ if [ -e "$LOG_DIR/nohup" ] && [ -z "$tail" ]; then
+ tail -F $LOG_DIR/nohup &
+ tail="$1"
+ fi
+ sleep 1
# Process command, disown version, stdout are preserved
#$APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} &
@@ -1807,7 +1814,7 @@ 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} >> $LOG_DIR/nohup 2>&1 &
+ nohup $APP_BASE/kvmx ${STDIN[0]} $VM ${STDIN[@]:1} < /dev/null >> $LOG_DIR/nohup 2>&1 &
tail -F $LOG_DIR/nohup &
# Process command, disown version
@@ -1819,6 +1826,11 @@ function kvmx_shell {
fi
fi
done
+
+ if [ ! -z "$tail" ]; then
+ kill $tail &> /dev/null
+ rm -f $LOG_DIR/nohup
+ fi
}
# Xrandr integration