-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathutils.sh
More file actions
executable file
·35 lines (30 loc) · 820 Bytes
/
Copy pathutils.sh
File metadata and controls
executable file
·35 lines (30 loc) · 820 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
#!/bin/bash
exit_if_failed() {
if [ $? -ne 0 ]
then
echo $1
exit 1
fi
}
replace_pgconf_setting() {
sed -r s/"^#? *$1 *=.*$"/"$1 = $2"/ /etc/postgresql/9.1/main/postgresql.conf > /etc/postgresql/9.1/main/postgresql.conf.tmp
exit_if_failed
mv -f /etc/postgresql/9.1/main/postgresql.conf.tmp /etc/postgresql/9.1/main/postgresql.conf
# Verify that it worked
grep "$1 = $2" /etc/postgresql/9.1/main/postgresql.conf
exit_if_failed "Unable to set $1 to $2"
}
read_value() {
echo "Please enter a value for $2:"
read $1
if [ "${!1}" == "" ]; then
echo "Invalid value. Exiting"
exit 1
fi
}
verify_postgres_user() {
if [ "`whoami`" != "postgres" ]; then
echo "Please run this script as the postgres user.";
exit 1
fi
}