systemdUninstaller.sh 628 Bytes
Newer Older
tomogoma's avatar
tomogoma committed
1 2 3 4 5 6 7 8 9 10
#!/bin/bash

APP_FILE="/usr/local/bin/cockroach"
ETCD_DIR="/etc/cockroachdb"
CERT_DIR="$ETCD_DIR/certs"
SYSTEMD_FILE="/etc/systemd/system/cockroach.service"
DATA_DIR="/var/data/cockroachdb/"

echo "Uninstalling..."

11
if [ -f "$SYSTEMD_FILE" ]; then
tomogoma's avatar
tomogoma committed
12
	systemctl stop cockroach.service >/dev/null
13 14
	rm -f "$SYSTEMD_FILE"
    systemctl daemon-reload
tomogoma's avatar
tomogoma committed
15 16
fi

17 18
if [ -f "$APP_FILE" ]; then
	rm -f "$APP_FILE"
tomogoma's avatar
tomogoma committed
19 20 21 22 23 24 25 26 27 28 29 30
fi

if [ -d "$ETCD_DIR" ]; then
	rm -rf "$ETCD_DIR"
fi
if [ -f "/usr/local/bin/cconnect" ]; then
    rm "/usr/local/bin/cconnect"
fi
echo "Data at $DATA_DIR not removed, run 'rm $DATA_DIR' if you wish to delete"
echo "Done!"

exit 0