# 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:"
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} &
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
fi
fi
done
+
+ if [ ! -z "$tail" ]; then
+ kill $tail &> /dev/null
+ rm -f $LOG_DIR/nohup
+ fi
}
# Xrandr integration