#!/bin/bash # Example startup script generator # Of course this isn't a production solution yet, this is just for tests # Copyright (c) Vitaliy Filippov, 2019+ # License: MIT IP=`ip -json a s | jq -r '.[].addr_info[] | select(.broadcast == "10.115.0.255") | .local'` [ "$IP" != "" ] || exit 1 BASE=${IP/*./} BASE=$((BASE-10)) useradd etcd mkdir -p /var/lib/etcd$BASE.etcd cat >/etc/systemd/system/etcd.service </etc/systemd/system/vitastor.target </etc/systemd/system/vitastor-osd$((BASE+i)).service </etc/systemd/system/vitastor-osd$((BASE+i)).service <