Skip to content
Snippets Groups Projects
Verified Commit bf56fc48 authored by Vincent Sellier's avatar Vincent Sellier
Browse files

swh-scrubber: Refactor the entrypoint to not only support database scrubbers

parent c0d16fe9
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
if [ -e "${SWH_CONFIG_FILENAME}" ]; then
echo "The config file ${SWH_CONFIG_FILENAME} does not exist."
exit 1
fi
ENV_VARS="LOGLEVEL STATSD_TAGS OBJECT_TYPE PARTITION_COUNT FIRST_PARTITION LAST_PARTITION"
ERROR=0
for VAR in ${ENV_VARS}; do
if [ -z "${!VAR}" ]; then
echo "The ${VAR} environment variable must be set"
ERROR=1
fi
done
if [ $ERROR -ne 0 ]; then
exit 1
fi
echo "Starting scrubber for OBJECT_TYPE=${OBJECT_TYPE} from FIRST_PARTITION=${FIRST_PARTITION} to LAST_PARTITION=${LAST_PARTITION}"
exec swh \
--log-level $LOGLEVEL \
scrubber check storage \
--object-type ${OBJECT_TYPE} \
--nb-partitions ${NB_PARTITIONS} \
--start-partition-id ${START_OBJECT} \
--end-partition-id ${END_OBJECT}
case "$1" in
"shell")
shift
if (( $# == 0)); then
exec bash -i
else
"$@"
fi
;;
"swh")
shift
echo "Running swh command $@"
exec swh $@
;;
*)
echo Unknown command $@
exit 1
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment