[Ovirt-devel] [PATCH node] Adds a log viewer option to o-c-setup. bz#506289

Darryl L. Pierce dpierce at redhat.com
Tue Jun 16 16:25:34 UTC 2009


A new menu option to view the file /var/log/ovirt.log is added. If the
file doesn't exist or is 0 bytes then a message saying the log is empty
is shown. Otherwise, it's displayed using the less command.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-setup |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup
index ee78254..11711e1 100755
--- a/scripts/ovirt-config-setup
+++ b/scripts/ovirt-config-setup
@@ -11,6 +11,8 @@ CONFIG_DIR=/etc/ovirt-config-setup.d
 # special options, all others execute the symlinked script in CONFIG_DIR
 DEBUG_SHELL="Shell"
 CONTINUE="Continue Stateless Boot"
+VIEW_LOG="View ovirt.log"
+OVIRT_LOG=/var/log/ovirt.log
 
 declare -a OPTIONS
 
@@ -33,6 +35,7 @@ for cfg in $CONFIG_DIR/*; do
 done
 OPTIONS[${#OPTIONS[*]}]="$DEBUG_SHELL"
 OPTIONS[${#OPTIONS[*]}]="$CONTINUE"
+OPTIONS[${#OPTIONS[*]}]="$VIEW_LOG"
 
 
 # reset tty, otherwise serial console is broken
@@ -51,6 +54,14 @@ while true; do
             case "$OPTION" in
                 "$DEBUG_SHELL") clear; bash; break ;;
                 "$CONTINUE") exit 0 ;;
+                "$VIEW_LOG")
+                    if [ -s $OVIRT_LOG ]; then
+                        clear
+                        less -R $OVIRT_LOG
+                    else
+                        printf "\nThe log is currently empty.\n\n"
+                    fi
+                    ;;
                 "") break ;;
                 *)
                     {
-- 
1.6.0.6




More information about the ovirt-devel mailing list