-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewSteward.sh
More file actions
56 lines (52 loc) · 1.5 KB
/
newSteward.sh
File metadata and controls
56 lines (52 loc) · 1.5 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
contactid=""
username=""
password=""
taxonomyexpert=""
databaseid=""
#########################
# The command line help #
#########################
display_help() {
echo "Usage: $0 [option...]" >&2
echo
echo " -c contactid New steward's contact ID"
echo " -u username New steward's username"
echo " -p password New steward's password"
echo " -t taxonomyexpert Is the steward a taxonomy expert? [true|false]"
echo " -d database Which database is the steward associate with?"
echo
echo " The script assumes that you have a ~/.pgpass file that contains your password"
echo " information. The file is described in detail on the Postgres documentation:"
echo " https://www.postgresql.org/docs/current/libpq-pgpass.html"
echo
# echo some stuff here for the -a or --add-options
exit 1
}
run_command() {
psql -h ${PGHOST} -p ${PGPORT} -d ${PGDB} -U ${PGUSER} -c \
"SELECT * FROM ts.insertsteward(_contactid:=$contactid, _username:=$username, _password:=$password, _taxonomyexpert:=$taxonomyexpert, _databaseid:=$databaseid );"
}
while getopts "hw:c:u:p:t:d:" optionName; do
case "$optionName" in
h)
display_help
exit 0
;;
c)
contactid="$OPTARG";;
u)
username="'$OPTARG'";;
p)
password="'$OPTARG'";;
t)
taxonomyexpert="$OPTARG";;
d)
databaseid="$OPTARG";;
[?])
display_help
exit 0
;;
esac
done
run_command