Compare commits
2 commits
d5bc036d26
...
6956971a89
Author | SHA1 | Date | |
---|---|---|---|
Chl | 6956971a89 | ||
Chl | 4e915e750e |
|
@ -8,7 +8,7 @@ set -e
|
|||
|
||||
# note: some local problems with IPv4, the quickest way was to force IPv6.
|
||||
LOCAL_VERSION="$( wget -6 -O - -q "https://$( hostname -f )/api/v1/version" | sed -n 's/{"version":"\([^"]\+\)"}/\1/p' )"
|
||||
UPSTREAM_VERSION="$( wget -q -O - "https://dl.gitea.io/gitea/" | egrep -o -- '<a href="/gitea/[0-9]+\.[0-9]+\.[0-9]+/"' | egrep -o "[0-9]+\.[0-9]+\.[0-9]+" | sort --version-sort | tail -n 1 )"
|
||||
UPSTREAM_VERSION="$( wget -q -O - "https://dl.gitea.io/gitea/" | egrep -- '<a href="/gitea/[0-9]+\.[0-9]+\.[0-9]+/?"' | egrep -o "[0-9]+\.[0-9]+\.[0-9]+" | sort --version-sort | tail -n 1 )"
|
||||
|
||||
if [ "$UPSTREAM_VERSION" = "$LOCAL_VERSION" ]; then
|
||||
echo "OK ($LOCAL_VERSION / $UPSTREAM_VERSION)"
|
||||
|
|
45
oldies/rrd-resize-double.sh
Executable file
45
oldies/rrd-resize-double.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script simply takes a rrd file and doubles the rows of all its RRA
|
||||
#
|
||||
# Result in tmp.rrd
|
||||
#
|
||||
# Make backups before any important use !
|
||||
|
||||
RESULT_FILENAME="result.rrd"
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f "$1" ]; then
|
||||
echo "ERROR: no file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SRC="$1"
|
||||
DST="$( dirname "$SRC" )/$RESULT_FILENAME"
|
||||
# rrdtool seems to always create in current directory
|
||||
RRD_SPECIAL_FILE="resize.rrd"
|
||||
|
||||
if [ -f "$RRD_SPECIAL_FILE" ] || [ -f "$DST" ]; then
|
||||
echo "ERROR: files with names '$RRD_SPECIAL_FILE' or '$DST' already exist. Trouble ?" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initial copy
|
||||
cp -ai "$SRC" "$DST"
|
||||
|
||||
# Only use the SRC for enumeration : all the work after that is done on DST
|
||||
rrdtool info "$SRC" | grep rows | while read LINE; do
|
||||
RRANUM="$( echo "$LINE" | sed 's/.*\[\([0-9]\+\)\].rows.*/\1/' )"
|
||||
ROWS="$( echo "$LINE" | sed 's/.* = //' )"
|
||||
if [ -z "$RRANUM" ] || [ -z "$ROWS" ]; then
|
||||
echo "Trouble at the mill." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rrdtool resize "$DST" $RRANUM GROW $ROWS && mv "$RRD_SPECIAL_FILE" "$DST"
|
||||
done
|
||||
|
||||
# I often forget this one...
|
||||
chmod "--reference=$SRC" "$DST"
|
||||
chown "--reference=$SRC" "$DST"
|
Loading…
Reference in a new issue