remove support for months as it isnt supported in InfluxQL

This commit is contained in:
m0duspwnens
2021-05-05 15:32:53 -04:00
parent db98b7ed27
commit 0ea4c99102

View File

@@ -15,15 +15,13 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
modurregex="^[0-9]+mo$"
wdurregex="^[0-9]+w$" wdurregex="^[0-9]+w$"
ddurregex="^[0-9]+d$" ddurregex="^[0-9]+d$"
echo -e "\nThis script is used to reduce the size of InfluxDB by removing old data and retaining only the duration specified." echo -e "\nThis script is used to reduce the size of InfluxDB by removing old data and retaining only the duration specified."
echo "The duration will need to be specified as an integer followed by the duration unit, without a space." echo "The duration will need to be specified as an integer followed by the duration unit, without a space."
echo -e "\nFor example, to purge all data, but retain the past 3 months, specify 3mo for the duration." echo -e "\nFor example, to purge all data, but retain the past 12 weeks, specify 12w for the duration."
echo "The duration units are as follows:" echo "The duration units are as follows:"
echo " mo - month(s)"
echo " w - week(s)" echo " w - week(s)"
echo " d - day(s)" echo " d - day(s)"
@@ -32,7 +30,7 @@ while true; do
read -p 'Enter the duration of past data that you would like to retain: ' duration read -p 'Enter the duration of past data that you would like to retain: ' duration
duration=$(echo $duration | tr '[:upper:]' '[:lower:]') duration=$(echo $duration | tr '[:upper:]' '[:lower:]')
if [[ "$duration" =~ $modurregex ]] || [[ "$duration" =~ $wdurregex ]] || [[ "$duration" =~ $ddurregex ]]; then if [[ "$duration" =~ $wdurregex ]] || [[ "$duration" =~ $ddurregex ]]; then
break break
fi fi