1#!/bin/bash
2
3if [[ -d /etc/opt/influxdb ]]; then
4    # Legacy configuration found
5    if [[ ! -d /etc/influxdb ]]; then
6	# New configuration does not exist, move legacy configuration to new location
7	echo -e "Please note, InfluxDB's configuration is now located at '/etc/influxdb' (previously '/etc/opt/influxdb')."
8	mv -vn /etc/opt/influxdb /etc/influxdb
9
10	if [[ -f /etc/influxdb/influxdb.conf ]]; then
11	    backup_name="influxdb.conf.$(date +%s).backup"
12	    echo "A backup of your current configuration can be found at: /etc/influxdb/$backup_name"
13	    cp -a /etc/influxdb/influxdb.conf /etc/influxdb/$backup_name
14	fi
15    fi
16fi
17