#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.2 1996/07/25 06:55:23 scrappy Exp $
#
#-------------------------------------------------------------------------
AUTHOPT="-a $AUTHSYS"
[ -z "$AUTHSYS" ] && AUTHOPT=""
-monitor -TN $AUTHOPT -h $PGHOST -p $PGPORT -c "create database $dbname" template1 || {
+psql -Tq $AUTHOPT -H $PGHOST -p $PGPORT -c "create database $dbname" template1 || {
echo "$CMDNAME: database creation failed on $dbname."
exit 1
}
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.2 1996/07/25 06:55:30 scrappy Exp $
#
# Note - this should NOT be setuid.
#
AUTHOPT="-a $AUTHSYS"
[ -z "$AUTHSYS" ] && AUTHOPT=""
-MARGS="-TN $AUTHOPT -h $PGHOST -p $PGPORT"
+PARGS="-T -q $AUTHOPT -H $PGHOST -p $PGPORT"
#
# generate the first part of the actual monitor command
#
-MONITOR="monitor $MARGS"
+PSQL="psql $PARGS"
#
# see if user $USER is allowed to create new users
QUERY="select usesuper from pg_user where usename = '$USER'"
#echo $QUERY
-ADDUSER=`$MONITOR -TN -c "$QUERY" template1`
+ADDUSER=`$PSQL -c "$QUERY" template1`
if [ $? -ne 0 ]
then
QUERY="select usesysid from pg_user where usename = '$NEWUSER'"
-RES=`$MONITOR -TN -c "$QUERY" template1`
+RES=`$PSQL -c "$QUERY" template1`
if [ $? -ne 0 ]
then
exit 1
fi
QUERY="select usename from pg_user where usesysid = '$SYSID'::int4"
- RES=`$MONITOR -TN -c "$QUERY" template1`
+ RES=`$PSQL -c "$QUERY" template1`
if [ $? -ne 0 ]
then
echo "$CMDNAME: database access failed."
values \
('$NEWUSER', $SYSID, '$CANCREATE', 't', '$CANADDUSER','t')"
-RES=`$MONITOR -TN -c "$QUERY" template1`
+RES=`$PSQL -c "$QUERY" template1`
#
# Wrap things up. If the user was created successfully, AND the user was
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.2 1996/07/25 06:55:41 scrappy Exp $
#
#-------------------------------------------------------------------------
AUTHOPT="-a $AUTHSYS"
[ -z "$AUTHSYS" ] && AUTHOPT=""
-monitor -TN -h $PGHOST -p $PGPORT -c "drop database $dbname" template1
+psql -Tq -H $PGHOST -p $PGPORT -c "drop database $dbname" template1
if [ $? -ne 0 ]
then
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.2 1996/07/25 06:55:49 scrappy Exp $
#
# Note - this should NOT be setuid.
#
AUTHOPT="-a $AUTHSYS"
[ -z "$AUTHSYS" ] && AUTHOPT=""
-MARGS="-TN $AUTHOPT -p $PGPORT -h $PGHOST"
+PARGS="-Tq $AUTHOPT -p $PGPORT -H $PGHOST"
#
# generate the first part of the actual monitor command
#
-MONITOR="monitor $MARGS"
+PSQL="psql $PARGS"
+
#
# see if user $USER is allowed to create new users. Only a user who can
#
QUERY="select usesuper from pg_user where usename = '$USER'"
-ADDUSER=`$MONITOR -c "$QUERY" template1`
+ADDUSER=`$PSQL -c "$QUERY" template1`
if [ $? -ne 0 ]
then
QUERY="select usesysid from pg_user where usename = '$DELUSER'"
-RES=`$MONITOR -c "$QUERY" template1`
+RES=`$PSQL -c "$QUERY" template1`
if [ $? -ne 0 ]
then
QUERY="select datname from pg_database where datdba = '$SYSID'::oid"
-ALLDBS=`$MONITOR -c "$QUERY" template1`
+ALLDBS=`$PSQL -c "$QUERY" template1`
if [ $? -ne 0 ]
then
echo "destroying database $i"
QUERY="drop database $i"
- $MONITOR -c "$QUERY" template1
+ $PSQL -c "$QUERY" template1
if [ $? -ne 0 ]
then
echo "$CMDNAME: drop database on $i failed - exiting"
QUERY="delete from pg_user where usename = '$DELUSER'"
-$MONITOR -c "$QUERY" template1
+$PSQL -c "$QUERY" template1
if [ $? -ne 0 ]
then
echo "$CMDNAME: delete of user $DELUSER was UNSUCCESSFUL"