Init
This commit is contained in:
32
stream-archive.sh
Normal file
32
stream-archive.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
PUID=${PUID:-1000}
|
||||
PGID=${PGID:-1000}
|
||||
|
||||
# Create group if GID doesn't exist
|
||||
if ! getent group "$PGID" > /dev/null 2>&1; then
|
||||
addgroup -g "$PGID" archivegroup
|
||||
fi
|
||||
GROUP_NAME=$(getent group "$PGID" | cut -d: -f1)
|
||||
|
||||
# Create user if UID doesn't exist
|
||||
if ! getent passwd "$PUID" > /dev/null 2>&1; then
|
||||
adduser -D -H -u "$PUID" -G "$GROUP_NAME" archiveuser
|
||||
fi
|
||||
|
||||
chown "$PUID:$PGID" /output
|
||||
|
||||
echo "[stream-archive] Running as UID=${PUID} GID=${PGID}"
|
||||
echo "[stream-archive] INPUT = ${INPUT}"
|
||||
echo "[stream-archive] OUTPUT = ${OUTPUT}"
|
||||
|
||||
exec su-exec "$PUID:$PGID" ffmpeg \
|
||||
-i "${INPUT}" \
|
||||
-c copy \
|
||||
-f segment \
|
||||
-reset_timestamps 1 \
|
||||
-segment_format mkv \
|
||||
-segment_time 3600 \
|
||||
-strftime 1 \
|
||||
"${OUTPUT}"
|
||||
Reference in New Issue
Block a user