-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreports.csh
More file actions
executable file
·38 lines (32 loc) · 855 Bytes
/
reports.csh
File metadata and controls
executable file
·38 lines (32 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/csh -f
#
# Wrapper for calling psql with public user/password for report format
#
# Usage:
#
# reports.sh inputfile outputfile DBSERVER DBNAME
#
# if no outputfile is specified, then will use the inputfile + ".rpt" extension
#
# HISTORY
#
# 07/23/2015
# - TR11750/Postgres only
#
# 10/06/2006 lec
# - TR 7943; added HEADERTYPE; removed trailer
#
source `dirname $0`/Configuration
if ( ${#argv} < 4 ) then
echo "Usage: $0 inputfile outputfile DBSERVER DBNAME [HEADERTYPE]"
exit 0
endif
setenv INPUTFILE $1
setenv OUTPUTFILE $2
setenv DBSERVER $3
setenv DBNAME $4
echo "#" > ${OUTPUTFILE}
echo "# Date Generated: `date`" >> ${OUTPUTFILE}
echo "# (server = ${DBSERVER}, database = ${DBNAME})" >> ${OUTPUTFILE}
echo "#" >> ${OUTPUTFILE}
psql -h ${PG_DBSERVER} -U ${PG_DBUSER} -d ${PG_DBNAME} ${PSQL_ECHO} -f${INPUTFILE} >> ${OUTPUTFILE}