I restore my database template on Linux as shown as: Linux teminal:
su postgres
psql
create database test3;
\q
pg_restore -v -d test3 /opt/empty-db_template.backup
exit
systemctl restart postgresql-11.service
And done!. But when I Executing Shell Commands in python as shown as Get stuck in psql
step, How can I fix it?
import os
os.system('ls')
os.system('su postgres')
os.system('psql')
os.system('create database test3;')
os.system('\q')
os.system('pg_restore -v -d test3 /opt/empty-db_template.backup')
os.system('exit')
os.system('systemctl restart postgresql-11.service')