install-mattermost.sh: ensure Mattermost starts after database service.

This commit is contained in:
2026-09-27 17:36:07 +02:00
parent 26965815c7
commit c7ce9f50ac
+16 -1
View File
@@ -1323,11 +1323,26 @@ echo
echo -e "\033[37m\033[1mSetup Mattermost to use systemd for starting and stopping..\033[m" echo -e "\033[37m\033[1mSetup Mattermost to use systemd for starting and stopping..\033[m"
echo echo
if [[ "$DB_TYPE" = "pgsql" ]] ; then
DATABASE_SYSTEMD_SERVICE="postgresql.service"
else
DATABASE_SYSTEMD_SERVICE="mysql.service"
fi
echononl "Check systemd unit '${DATABASE_SYSTEMD_SERVICE}'.."
if systemctl cat "$DATABASE_SYSTEMD_SERVICE" > "$log_file" 2>&1 ; then
echo_ok
else
echo_failed
fatal "Systemd unit '${DATABASE_SYSTEMD_SERVICE}' does not exist."
fi
echononl "Create a systemd unit file.." echononl "Create a systemd unit file.."
cat <<EOF > /etc/systemd/system/mattermost.service 2>"$log_file" cat <<EOF > /etc/systemd/system/mattermost.service 2>"$log_file"
[Unit] [Unit]
Description=Mattermost Description=Mattermost
After=network.target After=network.target ${DATABASE_SYSTEMD_SERVICE}
Requires=${DATABASE_SYSTEMD_SERVICE}
[Service] [Service]
Type=notify Type=notify