piler/util/compact-store-dir.sh
Janos SUTO 5b3161e685 Fixed zip structure
Signed-off-by: Janos SUTO <sj@acts.hu>
2020-09-08 20:10:19 +02:00

31 lines
424 B
Bash
Executable File

#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
SCRIPT_PATH="$(readlink -f "$0")"
SCRIPT_NAME="${SCRIPT_PATH##*/}"
SERVERID="00"
usage() {
echo "usage: ${SCRIPT_NAME} <topdir>"
exit 1
}
[[ $# -gt 0 ]] || usage
TOPDIR="$1"
cd "/var/piler/store/${SERVERID}"
for i in "$TOPDIR"/*; do
pushd "$i" > /dev/null
d="$(basename "$i")"
zip -r -0 -q -m "${TOPDIR}_${d}.zip" .
popd > /dev/null
done