| 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. |
|---|
| 20 | if $DEBUG ; then |
|---|
| 21 | exec 1>&2 |
|---|
| 22 | else |
|---|
| 23 | exec 1>/dev/null |
|---|
| 24 | fi |
|---|
| 25 | |
|---|
| 26 | REPO_URI="file://$REPO_PATH" |
|---|
| 27 | backup=`mktemp -t confman` |
|---|
| 28 | |
|---|
| 29 | echo "Backing up $CONF_EXPORT_FILE" |
|---|
| 30 | cp $CONF_EXPORT_FILE $backup |
|---|
| 31 | |
|---|
| 32 | echo "Beginning export operation." | conf_logger |
|---|
| 33 | if ! 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 |
|---|
| 38 | fi |
|---|
| 39 | echo "Export complete." | conf_logger |
|---|
| 40 | |
|---|
| 41 | echo "Removing $backup" |
|---|
| 42 | rm $backup |
|---|
| 43 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.