1
0
forked from ScoDoc/ScoDoc

Script export données pour ScoDoc 9

This commit is contained in:
IDK 2021-08-18 13:11:03 +02:00
parent 529b01353a
commit 48d5995a2a

View File

@ -44,12 +44,13 @@ scodocctl stop
echo "Dumping SQL databases..." echo "Dumping SQL databases..."
chown postgres "$DEST" chown postgres "$DEST"
for cfgfile in "$SCODOC_VAR_DIR"/config/depts/*cfg for cfgfile in "$INSTANCE_DIR"/var/scodoc/config/depts/*cfg USERS
do do
cfgfile=$(basename "$cfgfile")
dept="${cfgfile%*.cfg}" dept="${cfgfile%*.cfg}"
db_name="SCO$dept" db_name="SCO$dept"
echo "$db_name" echo "$db_name"
su -c "pg_dump --format=custom --file=\"$DEST/$db_name.dump\" \"$db_name\"" su -c "pg_dump --format=custom --file=\"$DEST/$db_name.dump\" \"$db_name\"" postgres
if [ ! "$?" -eq 0 ] if [ ! "$?" -eq 0 ]
then then
printf "Error dumping postgresql database\nPlease check that SQL server is running\nAborting." printf "Error dumping postgresql database\nPlease check that SQL server is running\nAborting."