-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjellyplex-sync.sh
More file actions
23 lines (18 loc) · 832 Bytes
/
Copy pathjellyplex-sync.sh
File metadata and controls
23 lines (18 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
IMAGE="ghcr.io/sniner/jellyplex-sync"
VERSION="latest"
# Pull the latest version of the image from the registry
docker pull $IMAGE:$VERSION
# Get the full SHA256 ID of the current image
CURRENT_ID=$(docker images --no-trunc --quiet $IMAGE:$VERSION)
# Find and remove any older versions of the same image
docker images --no-trunc --format "{{.Repository}} {{.ID}}" \
| awk -v img="$IMAGE" -v curr="$CURRENT_ID" '$1 == img && $2 != curr { print $2 }' \
| while read -r image_id; do
echo "Removing old image: $image_id"
docker rmi "$image_id"
done
# Execute jellyplex-sync with mounted media directory
# NOTE: Adjust the paths below to match your actual media directories!
docker run --rm -v /mnt/user/media:/mnt $IMAGE:$VERSION \
sync --delete --create --dry-run /mnt/Movies /mnt/Plex