mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
It is now /dev/nvme1n1, not /dev/nvme0n1; but it always has a consistent major/minor node. Source the file that defines these.
32 lines
745 B
Bash
Executable File
32 lines
745 B
Bash
Executable File
#!/bin/sh
|
|
set -x
|
|
set -e
|
|
|
|
# This file only exists on the server, ignore its non-existence locally
|
|
# shellcheck disable=SC1091
|
|
. "/sys/dev/block/259:0/uevent"
|
|
|
|
LOCALDISK="/dev/$DEVNAME"
|
|
if ! grep -q "$LOCALDISK" /etc/fstab; then
|
|
echo "$LOCALDISK /srv xfs nofail,noatime 1 1" >>/etc/fstab
|
|
fi
|
|
|
|
if ! mountpoint -q /srv; then
|
|
mkfs.xfs "$LOCALDISK"
|
|
mount /srv
|
|
fi
|
|
|
|
if [ ! -L /var/lib/postgresql ]; then
|
|
service postgresql stop
|
|
if [ -e /var/lib/postgresql ]; then
|
|
mv /var/lib/postgresql "/root/postgresql-data-$(date +'%m-%d-%Y-%T')"
|
|
fi
|
|
ln -s /srv/postgresql/ /var/lib
|
|
fi
|
|
|
|
if [ ! -e "/srv/postgresql" ]; then
|
|
service postgresql stop
|
|
mkdir "/srv/postgresql"
|
|
chown postgres:postgres /srv/postgresql
|
|
fi
|