Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
apisub
Commits
c8c0e5e2
Commit
c8c0e5e2
authored
Dec 03, 2019
by
Stephane Crozat
Browse files
Adding backup
parent
9bea8e83
Changes
6
Hide whitespace changes
Inline
Side-by-side
INSTALL
View file @
c8c0e5e2
...
...
@@ -5,7 +5,23 @@ add student.csv to data
## Create user and db
sudo su postgres
sql/db_init.sh password
sh/apisub_init.sh password
## Create apisub user for backup
useradd -m apisub
mkdir /home/apisub/backup
chown apisub:postgres /home/apisub/backup
chmod 770 /home/apisub/backup
## Setup backup scripts and cron
cp sh/apisub_backup.sh /usr/bin
chown postgres:postgres /usr/bin/apisub_backup.sh
cp sh/apisub_ssh.sh /usr/bin
chown apisub:apisub /usr/bin/apisub_backup.sh
su apisub
crontab -e
su postgres
crontab -e
## pgcrypto module
apt install postgresql-contrib
...
...
sh/apisub_backup.sh
0 → 100755
View file @
c8c0e5e2
#!/bin/bash
# Execute as postgres user
# crontab -e : 0 * * * * /media/stc/data/git/apisub/sql/apisub_backup.sh
path
=
'/home/apisub/backup'
date
=
`
date
-Iminutes
`
echo
"
$date
"
file
=
"
$path
/apisub_
$date
.dump"
echo
"Backuping apisub to
$file
"
pg_dump
-cC
--file
$file
apisub
s
ql/d
b_init.sh
→
s
h/apisu
b_init.sh
View file @
c8c0e5e2
File moved
sh/apisub_ssh.sh
0 → 100755
View file @
c8c0e5e2
#!/bin/bash
# Execute as apisub user
# crontab -e : 5 * * * * /media/stc/data/git/apisub/sql/apisub_ssh.sh
src
=
'/home/apisub/backup/'
dest
=
'/home/apisub/backup/'
#user='apisub'
user
=
'root'
host
=
'bdu.crzt.fr'
echo
"rsync
$src
/*
$user
@
$host
:
$dest
"
rsync
$src
/
*
$user
@
$host
:/
$dest
tmp/export/README.md
View file @
c8c0e5e2
# Génération du fichier SQL à partir de l'archive XML de Scenari
Dans Scenari, depuis
`catalogue.website`
, exporter une archive
`catalogue.scar`
(clic droit)
Dans Scenari, depuis
`catalogue.website`
, exporter une archive
`catalogue.scar`
(clic droit)
dans /tmp
cd /tmp
mv catalogue.scar catalogue.zip &&
rm -rf catxml &&
unzip catalogue.zip -d catxml
...
...
tmp/import/README.md
View file @
c8c0e5e2
...
...
@@ -5,7 +5,7 @@ fichier CSV : utclogin;level
```
DELETE FROM student;
\copy student FROM '
data
/students.csv' DELIMITER ';'
\copy student FROM '
/tmp
/students.csv' DELIMITER ';'
```
## Sync de la base de prod avec la base locale (pour tests)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment