1#!/bin/sh
2
3# This file is free software; you can redistribute it and/or modify it
4# under the terms of the GNU Lesser General Public License as published by
5# the Free Software Foundation; either version 2.1 of the License, or
6# (at your option) any later version.
7
8if [ "${1}" = "-h" ] || [ "${1}" = "--help" ]; then
9    cat <<EOF
10
11Usage: ${0}
12
13    The script galera_new_cluster is used to bootstrap new Galera Cluster,
14    when all the nodes are down. Run galera_new_cluster on the first node only.
15    On the remaining nodes simply run 'service @DAEMON_NAME@ start'.
16
17    For more information on Galera Cluster configuration and usage see:
18    https://mariadb.com/kb/en/mariadb/getting-started-with-mariadb-galera-cluster/
19
20EOF
21    exit 0
22fi
23
24systemctl set-environment _WSREP_NEW_CLUSTER='--wsrep-new-cluster' && \
25    systemctl start ${1:-mariadb}
26
27extcode=$?
28
29systemctl set-environment _WSREP_NEW_CLUSTER=''
30
31exit $extcode
32