2013-04-17 22:15:10 +02:00
|
|
|
#!/bin/sh
|
2020-05-30 01:12:20 +02:00
|
|
|
set -x
|
|
|
|
set -e
|
2013-04-22 17:06:54 +02:00
|
|
|
|
2020-05-30 01:12:20 +02:00
|
|
|
LOCALDISK=/dev/nvme0n1
|
2013-04-22 17:06:54 +02:00
|
|
|
|
2020-05-30 01:12:20 +02:00
|
|
|
if ! grep -q $LOCALDISK /etc/fstab; then
|
2020-10-15 04:55:57 +02:00
|
|
|
echo "$LOCALDISK /srv xfs nofail,noatime 1 1" >>/etc/fstab
|
2020-05-30 01:12:20 +02:00
|
|
|
fi
|
2016-07-19 03:37:50 +02:00
|
|
|
|
2020-05-30 01:12:20 +02:00
|
|
|
if ! mountpoint -q /srv; then
|
|
|
|
mkfs.xfs $LOCALDISK
|
|
|
|
mount /srv
|
|
|
|
fi
|
2013-04-17 22:15:10 +02:00
|
|
|
|
2020-05-30 01:12:20 +02:00
|
|
|
if [ ! -L /var/lib/postgresql ]; then
|
|
|
|
service postgresql stop
|
|
|
|
if [ -e /var/lib/postgresql ]; then
|
2020-10-27 23:33:35 +01:00
|
|
|
mv /var/lib/postgresql "/root/postgresql-data-$(date +'%m-%d-%Y-%T')"
|
2020-05-30 01:12:20 +02:00
|
|
|
fi
|
|
|
|
ln -s /srv/postgresql/ /var/lib
|
|
|
|
fi
|
2013-05-08 22:54:25 +02:00
|
|
|
|
2020-05-30 01:12:20 +02:00
|
|
|
if [ ! -e "/srv/postgresql" ]; then
|
|
|
|
service postgresql stop
|
|
|
|
mkdir "/srv/postgresql"
|
|
|
|
chown postgres:postgres /srv/postgresql
|
|
|
|
fi
|