You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
426 B
14 lines
426 B
[Unit]
|
|
Description=Load/Dump database on start/stop
|
|
After=postgresql.service
|
|
Requires=postgresql.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=yes
|
|
EnvironmentFile=/etc/environment
|
|
ExecStart=/bin/bash -c "if [[ $(ls -t /vol/data/sql/ | head -1) == $DBNAME-updown.sql ]]; then db-load /vol/data/sql/$DBNAME-updown.sql; fi"
|
|
ExecStop=/bin/bash -c "db-dump /vol/data/sql/$DBNAME-updown.sql"
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|