/[fai]/trunk/lib/fai-savelog
ViewVC logotype

Contents of /trunk/lib/fai-savelog

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1584 - (hide annotations) (download)
Thu Jan 30 11:18:39 2003 UTC (10 years, 3 months ago) by lange
File size: 3522 byte(s)
rename variable
1 lange 1367 #! /bin/sh
2    
3     # $Id$
4     #*********************************************************************
5     #
6     # fai-save-log -- save log files from fai to a local or remote location
7     #
8     # This script is part of FAI (Fully Automatic Installation)
9 lange 1573 # (c) 2002-2003 by Thomas Lange, lange@informatik.uni-koeln.de
10 lange 1367 # Universitaet zu Koeln
11     #
12     #*********************************************************************
13     # This program is free software; you can redistribute it and/or modify
14     # it under the terms of the GNU General Public License as published by
15     # the Free Software Foundation; either version 2 of the License, or
16     # (at your option) any later version.
17     #
18     # This program is distributed in the hope that it will be useful, but
19     # WITHOUT ANY WARRANTY; without even the implied warranty of
20     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21     # General Public License for more details.
22     #
23     # A copy of the GNU General Public License is available as
24     # `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
25     # or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You
26     # can also obtain it by writing to the Free Software Foundation, Inc.,
27     # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28     #*********************************************************************
29    
30     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
31     save_log_local() {
32    
33    
34     # can be an extern script
35     # save log files on local disk
36    
37     # LOGSERVER is overridable until now
38     [ -z "$LOGSERVER" ] && LOGSERVER=$LOGSERVER
39     local logbase=$FAI_ROOT/var/log/fai
40 lange 1584 local thislog=$logbase/$HOSTNAME/$FAI_ACTION-$FAI_RUNDATE
41 lange 1367 find $LOGDIR -size 0 -type f | xargs -r rm
42     mkdir -p $thislog
43     cp -p $LOGDIR/* $thislog
44     ln -sf $HOSTNAME $logbase/localhost
45 lange 1584 ln -snf $FAI_ACTION-$FAI_RUNDATE $logbase/$HOSTNAME/last-$FAI_ACTION
46     ln -snf $FAI_ACTION-$FAI_RUNDATE $logbase/$HOSTNAME/last
47 lange 1367 }
48     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49     save_log_remote() {
50    
51     # can be an extern script
52     # save log files to $LOGUSER/$HOSTNAME/.. on $LOGSERVER
53     # also create a link last-$FAI_ACTION the the directory of the
54     # last action. The name of the log directory contains date and
55     # time of the action performed
56    
57     [ "$LOGUSER" ] || return
58     # LOGSERVER is overridable until now
59     [ -z "$LOGSERVER" ] && LOGSERVER=$SERVER
60    
61 lange 1584 echo "Save log files via $FAI_REMOTESH to $LOGUSER@$LOGSERVER:$HOSTNAME/$FAI_ACTION-$FAI_RUNDATE"
62     local thislog=$HOSTNAME/$FAI_ACTION-$FAI_RUNDATE
63 lange 1367 find $LOGDIR -size 0 -type f | xargs -r rm
64     $FAI_REMOTESH -l $LOGUSER $LOGSERVER " \
65     mkdir -p $thislog ;\
66     cd $HOSTNAME ;\
67     rm -f last-$FAI_ACTION ;\
68 lange 1584 ln -snf $FAI_ACTION-$FAI_RUNDATE last-$FAI_ACTION ;\
69     ln -snf $FAI_ACTION-$FAI_RUNDATE last"
70 lange 1367
71     $FAI_REMOTECP -p $LOGDIR/* $LOGUSER@$LOGSERVER:$thislog
72     }
73     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74     usage() {
75    
76     cat <<EOF
77     fai-savelog, save log files from fai to a local or remote location
78    
79     Copyright (C) 2002 by Thomas Lange
80    
81     Usage: fai-savelog [OPTION]
82    
83     -r Save log files to \$LOGSERVER using rcp or scp
84     -l Save log files to local directory \$FAI_ROOT/var/log/fai
85    
86     Report bugs to <lange@informatik.uni-koeln.de>.
87     EOF
88     exit 0
89    
90    
91     }
92    
93    
94     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
95    
96     [ "$1" ] || usage
97    
98     while getopts lr opt ; do
99     case "$opt" in
100     l) save_log_local ;;
101     r) save_log_remote ;;
102     *) usage ;;
103     esac
104     done

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5