Skip to content

Commit

Permalink
add optional LOGBASE to save local logs to a differnet directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrfai committed Dec 8, 2023
1 parent a592ab2 commit 2104b28
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/fai-savelog
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# fai-save-log -- save log files from fai to a local or remote location
#
# This script is part of FAI (Fully Automatic Installation)
# (c) 2002-2015 by Thomas Lange, lange@cs.uni-koeln.de
# (c) 2002-2023 by Thomas Lange, lange@cs.uni-koeln.de
# Universitaet zu Koeln
#
#*********************************************************************
Expand All @@ -32,10 +32,8 @@ save_log_local() {

# can be an extern script
# save log files on local disk

local logbase=$FAI_ROOT/var/log/fai
local logbase=${LOGBASE:-"$FAI_ROOT/var/log/fai"}
local thislog=$logbase/$HOSTNAME/$FAI_ACTION-$fai_rundate

find $LOGDIR -xdev -size 0 -type f -exec rm {} \;
# create the symbolic links forcefully; in case of dirinstalls or
# softupdates they already exist as the fai script creates them together
Expand Down Expand Up @@ -119,12 +117,12 @@ usage() {
cat <<EOF
fai-savelog, save log files from fai to a local or remote location
Copyright (C) 2002-2015 by Thomas Lange
Copyright (C) 2002-2023 by Thomas Lange
Usage: fai-savelog [OPTION]
-r Save log files to \$LOGSERVER using rcp or scp
-l Save log files to local directory \$FAI_ROOT/var/log/fai
-r Save log files to \$LOGSERVER using rcp or scp
-l [LOGBASE] Save log files to a local directory. If LOGBASE is not provided, use \$FAI_ROOT/var/log/fai
EOF
exit 0
Expand All @@ -136,7 +134,7 @@ exit 0
: ${FAI_ACTION:=noaction}
while getopts lr opt ; do
case "$opt" in
l) save_log_local ;;
l) LOGBASE=$2 save_log_local ;;
r) save_log_remote ;;
*) usage ;;
esac
Expand Down

0 comments on commit 2104b28

Please sign in to comment.