Modified init scripts for inclusion in Fedora
[ovirt-node/TEMP.git] / scripts / ovirt-config-view-logs
blob70c52298134038f3bed2b439781e2311c9f30a4f
1 #!/bin/bash
4 . /etc/init.d/ovirt-functions
6 ME=$(basename "$0")
7 warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
8 die() { warn "$*"; exit 1; }
10 trap '__st=$?; stop_log; exit $__st' 0
11 trap 'exit $?' 1 2 13 15
13 RETURN_TO_MENU="Return To Menu"
15 OPTIONS[${#OPTIONS[*]}]="/var/log/ovirt.log"
16 OPTIONS[${#OPTIONS[*]}]="/var/log/messages"
17 OPTIONS[${#OPTIONS[*]}]="/var/log/secure"
18 OPTIONS[${#OPTIONS[*]}]="$RETURN_TO_MENU"
20 while true; do
21 printf "\nPlease select a log file to view.\n\n"
22 PS3="Please select a log to view: "
23 select OPTION in "${OPTIONS[@]}"
25 case $OPTION in
26 "$RETURN_TO_MENU") exit 0;;
27 "") break;;
29 if [ -s "$OPTION" ]; then
30 clear
31 less -R "$OPTION"
32 printf "\n\n"
33 else
34 printf "$OPTION is empty\n\n"
37 esac
38 done
39 done