-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrunbench.sh
More file actions
21 lines (16 loc) · 751 Bytes
/
runbench.sh
File metadata and controls
21 lines (16 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Re-generate Postgres database space.
su - postgres -c "mkdir /tmp/pgsql-bench"
su - postgres -c "/usr/lib/postgresql/9.3/bin/initdb -D /tmp/pgsql-bench"
# Change port to prevent existing other postgres intances to cause conflict.
sed -i -e 's/^#port =.*$/port = 5431/' /tmp/pgsql-bench/postgresql.conf
sed -i -e "s|^#unix_socket_directories.*|unix_socket_directories = '/tmp'|" /tmp/pgsql-bench/postgresql.conf
chown postgres /tmp/pgsql-bench/postgresql.conf
# launch postgres
su - postgres -c "nohup /usr/lib/postgresql/9.3/bin/postgres -D /tmp/pgsql-bench" &
echo $! > run.pid
sleep 5
# Create database
su - postgres -c "createdb -h /tmp -p 5431 --template=template0 -E UTF-8 testDb"
# Start benchmark
su - postgres -c "python3 $*"