Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff50e5a

Browse files
committed
Switched from using monitor to using psql
Submitted by: Rick Weldon <rick@wisetech.com>
1 parent69ee15d commitff50e5a

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

‎src/bin/createdb/createdb.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
#
1313
# IDENTIFICATION
14-
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
14+
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.2 1996/07/25 06:55:23 scrappy Exp $
1515
#
1616
#-------------------------------------------------------------------------
1717

@@ -58,7 +58,7 @@ done
5858
AUTHOPT="-a$AUTHSYS"
5959
[-z"$AUTHSYS" ]&& AUTHOPT=""
6060

61-
monitor -TN$AUTHOPT -h$PGHOST -p$PGPORT -c"create database$dbname" template1|| {
61+
psql -Tq$AUTHOPT -H$PGHOST -p$PGPORT -c"create database$dbname" template1|| {
6262
echo"$CMDNAME: database creation failed on$dbname."
6363
exit 1
6464
}

‎src/bin/createuser/createuser.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
#
1010
# IDENTIFICATION
11-
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
11+
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.2 1996/07/25 06:55:30 scrappy Exp $
1212
#
1313
# Note - this should NOT be setuid.
1414
#
@@ -55,13 +55,13 @@ done
5555
AUTHOPT="-a$AUTHSYS"
5656
[-z"$AUTHSYS" ]&& AUTHOPT=""
5757

58-
MARGS="-TN$AUTHOPT -h$PGHOST -p$PGPORT"
58+
PARGS="-T -q$AUTHOPT -H$PGHOST -p$PGPORT"
5959

6060
#
6161
# generate the first part of the actual monitor command
6262
#
6363

64-
MONITOR="monitor$MARGS"
64+
PSQL="psql$PARGS"
6565

6666
#
6767
# see if user $USER is allowed to create new users
@@ -70,7 +70,7 @@ MONITOR="monitor $MARGS"
7070
QUERY="select usesuper from pg_user where usename = '$USER'"
7171
#echo $QUERY
7272

73-
ADDUSER=`$MONITOR -TN -c"$QUERY" template1`
73+
ADDUSER=`$PSQL -c"$QUERY" template1`
7474

7575
if [$?-ne 0 ]
7676
then
@@ -100,7 +100,7 @@ fi
100100

101101
QUERY="select usesysid from pg_user where usename = '$NEWUSER'"
102102

103-
RES=`$MONITOR -TN -c"$QUERY" template1`
103+
RES=`$PSQL -c"$QUERY" template1`
104104

105105
if [$?-ne 0 ]
106106
then
@@ -142,7 +142,7 @@ do
142142
exit 1
143143
fi
144144
QUERY="select usename from pg_user where usesysid = '$SYSID'::int4"
145-
RES=`$MONITOR -TN -c"$QUERY" template1`
145+
RES=`$PSQL -c"$QUERY" template1`
146146
if [$?-ne 0 ]
147147
then
148148
echo"$CMDNAME: database access failed."
@@ -206,7 +206,7 @@ QUERY="insert into pg_user \
206206
values\
207207
('$NEWUSER',$SYSID, '$CANCREATE', 't', '$CANADDUSER','t')"
208208

209-
RES=`$MONITOR -TN -c"$QUERY" template1`
209+
RES=`$PSQL -c"$QUERY" template1`
210210

211211
#
212212
# Wrap things up. If the user was created successfully, AND the user was

‎src/bin/destroydb/destroydb.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
#
1313
# IDENTIFICATION
14-
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
14+
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.2 1996/07/25 06:55:41 scrappy Exp $
1515
#
1616
#-------------------------------------------------------------------------
1717

@@ -58,7 +58,7 @@ done
5858
AUTHOPT="-a$AUTHSYS"
5959
[-z"$AUTHSYS" ]&& AUTHOPT=""
6060

61-
monitor -TN -h$PGHOST -p$PGPORT -c"drop database$dbname" template1
61+
psql -Tq -H$PGHOST -p$PGPORT -c"drop database$dbname" template1
6262

6363
if [$?-ne 0 ]
6464
then

‎src/bin/destroyuser/destroyuser.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
#
1010
# IDENTIFICATION
11-
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $
11+
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.2 1996/07/25 06:55:49 scrappy Exp $
1212
#
1313
# Note - this should NOT be setuid.
1414
#
@@ -55,20 +55,21 @@ done
5555
AUTHOPT="-a$AUTHSYS"
5656
[-z"$AUTHSYS" ]&& AUTHOPT=""
5757

58-
MARGS="-TN$AUTHOPT -p$PGPORT -h$PGHOST"
58+
PARGS="-Tq$AUTHOPT -p$PGPORT -H$PGHOST"
5959

6060
#
6161
# generate the first part of the actual monitor command
6262
#
63-
MONITOR="monitor$MARGS"
63+
PSQL="psql$PARGS"
64+
6465

6566
#
6667
# see if user $USER is allowed to create new users. Only a user who can
6768
# create users can delete them.
6869
#
6970

7071
QUERY="select usesuper from pg_user where usename = '$USER'"
71-
ADDUSER=`$MONITOR -c"$QUERY" template1`
72+
ADDUSER=`$PSQL -c"$QUERY" template1`
7273

7374
if [$?-ne 0 ]
7475
then
@@ -93,7 +94,7 @@ fi
9394

9495
QUERY="select usesysid from pg_user where usename = '$DELUSER'"
9596

96-
RES=`$MONITOR -c"$QUERY" template1`
97+
RES=`$PSQL -c"$QUERY" template1`
9798

9899
if [$?-ne 0 ]
99100
then
@@ -117,7 +118,7 @@ SYSID=`echo $RES | sed 's/ //g'`
117118
QUERY="select datname from pg_database where datdba = '$SYSID'::oid"
118119

119120

120-
ALLDBS=`$MONITOR -c"$QUERY" template1`
121+
ALLDBS=`$PSQL -c"$QUERY" template1`
121122

122123
if [$?-ne 0 ]
123124
then
@@ -170,7 +171,7 @@ then
170171
echo"destroying database$i"
171172

172173
QUERY="drop database$i"
173-
$MONITOR -c"$QUERY" template1
174+
$PSQL -c"$QUERY" template1
174175
if [$?-ne 0 ]
175176
then
176177
echo"$CMDNAME: drop database on$i failed - exiting"
@@ -181,7 +182,7 @@ fi
181182

182183
QUERY="delete from pg_user where usename = '$DELUSER'"
183184

184-
$MONITOR -c"$QUERY" template1
185+
$PSQL -c"$QUERY" template1
185186
if [$?-ne 0 ]
186187
then
187188
echo"$CMDNAME: delete of user$DELUSER was UNSUCCESSFUL"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp