#!/bin/bash

set -x
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace

sudo systemctl stop approx-derivative-maker.socket

sudo mkdir --parents /var/cache/approx-derivative-maker

sudo find /var/cache/approx-derivative-maker -mindepth 1 -not -ipath '*.git*' -print0 | xargs -0 sudo safe-rm --verbose -r -f

sudo chown --recursive approx:approx /var/cache/approx-derivative-maker

sudo systemctl restart approx-derivative-maker.socket
