source: tags/confman-1.5.4.6/export.sh @ 150

Revision 150, 1.0 KB checked in by ccowart, 5 years ago (diff)

Fixing up logging vs stderr.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
1#! /bin/bash
2
3##
4# This script prepares an "export" of the confman repository for system
5# processes to be able to pull. It is intended to be prepared regularly
6# by a cron. It may be useful to modify this script to only prepare
7# the export if the repository's most recent commit post-dates the
8# tarball.
9#
10# Author:   Chris Cowart <ccowart@rescomp.berkeley.edu>
11#           4 December 2006
12#
13# $Id$
14##
15
16. /usr/local/rescomp/lib/confmancommon.sh
17
18# If we're in debug mode, we should log stderr messages to the logger
19# as well. Otherwise, we send them to the bit bucket.
20if $DEBUG ; then
21    exec 1>&2
22else
23    exec 1>/dev/null
24fi
25
26REPO_URI="file://$REPO_PATH"
27backup=`mktemp -t confman`
28
29echo "Backing up $CONF_EXPORT_FILE"
30cp $CONF_EXPORT_FILE $backup
31
32echo "Beginning export operation." | conf_logger
33if ! conf_export $CONF_EXPORT_FILE ; then
34    echo "The export failed. Restoring $CONF_EXPORT_FILE from backup." >&2
35    mv $backup $CONF_EXPORT_FILE
36    echo "Exiting." >&2
37    exit 1
38fi
39echo "Export complete." | conf_logger
40
41echo "Removing $backup"
42rm $backup
43
Note: See TracBrowser for help on using the repository browser.