source: trunk/third/moira/gen/ip-billing.sh @ 24250

Revision 24250, 1.0 KB checked in by broder, 15 years ago (diff)
New Moira snapshot from subversion. Sorry for the large diff - looks like all of the keywords changed in the SVN import process.
  • Property svn:executable set to *
RevLine 
[23095]1#!/bin/sh
2#
[24250]3# $Header: /afs/.athena.mit.edu/astaff/project/moiradev/repository/moira/gen/ip-billing.sh,v 1.2 2002-03-19 22:07:06 zacheiss Exp $
[23095]4
5PATH=/usr/bin:/bin:/usr/sbin:/sbin
6
7if [ -d /var/athena ] && [ -w /var/athena ]; then
8    exec >/var/athena/moira_update.log 2>&1
9else
10    exec >/tmp/moira_update.log 2>&1
11fi
12
13# The following exit codes are defined and MUST BE CONSISTENT with the
14# error codes the library uses:
15MR_MISSINGFILE=47836473
16MR_TARERR=47836476
17MR_MKCRED=47836474
18
19OUTFILE=/var/tmp/ip-billing.out
20OUTDIR=/var/tmp/ip-billing.dir
21
22# Alert if the output file doesn't exist
23test -r $OUTFILE || exit $MR_MISSINGFILE
24
25# Make a temporary directory to unpack files into.
26rm -rf $OUTDIR
27mkdir $OUTDIR || exit $MR_MKCRED
28cd $OUTDIR || exit $MR_MKCRED
29
30# unpack the file
31tar xpf $OUTFILE || exit $MR_TARERR
32for i in ctl dat; do
33    if [ ! -f moira.$i ]; then
34        exit $MR_MISSINGFILE
35    fi
36    mv moira.$i /var/tmp
37done
38
39# cleanup
40cd /
41rm -rf $OUTDIR
42test -f $OUTFILE && rm -f $OUTFILE
43test -f $0 && rm -f $0
44
45exit 0
Note: See TracBrowser for help on using the repository browser.