Skip to content

Commit

Permalink
Merge pull request #28 from troykelly/27-xteve-is-not-cleaning-up-tmp
Browse files Browse the repository at this point in the history
Adding xteve temp cleanup
  • Loading branch information
troykelly authored Jan 28, 2023
2 parents 44fb9d6 + fcb2b98 commit c99668d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ jobs:
uses: docker/setup-buildx-action@v2
with:
install: true
driver-opts: |
image=moby/buildkit:v0.10.6

- name: 🏗 Login to Docker Container Registry
uses: docker/login-action@v2
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ jobs:
uses: docker/setup-buildx-action@v2
with:
install: true
driver-opts: |
image=moby/buildkit:v0.10.6

- name: 🏗 Login to Docker Container Registry
uses: docker/login-action@v2
Expand Down
20 changes: 20 additions & 0 deletions xteve/rootfs/usr/local/bin/docker-xteve-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,29 @@ else
groupmod -g ${GID} xteve
fi

if [[ -z "${MAXTEMPAGE}" ]]; then
MAXTEMPAGE=10
fi

chown -R ${UID}:${GID} /etc/xteve

cleanup_temp () {
mkdir -p /tmp/xteve
chown -R xteve:xteve /tmp/xteve
while :
do
find /tmp/xteve/ -type f -name "*.ts" -mmin "+${MAXTEMPAGE}" -delete
sleep 60
done
}

if [[ -x "/usr/bin/xteve" ]]; then
echo >&2 "🆗 Ready 3"
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
cleanup_temp &
cleanuppid=$!
echo >&2 "🧹 Started xteve tmp cleanup ${cleanuppid}"
echo >&2 "📺 Starting xteve with settings \"$@\""
sudo -H -u xteve -- "/usr/local/bin/xteve_enable_mappings"
sudo -H -u xteve -- "/usr/bin/xteve" "$@" &
Expand All @@ -30,6 +47,9 @@ if [[ -x "/usr/bin/xteve" ]]; then
fi
echo >&2 "🕴️ Waiting for process ${pid} to finish"
wait ${pid}
if [[ ! -z "${cleanuppid}" ]]; then
kill -s SIGTERM ${cleanuppid}
fi
else
echo >&2 "🛑 No xteve executable"
fi

0 comments on commit c99668d

Please sign in to comment.