Files
YoutubeDL-Material/backend/entrypoint.sh
Isaac Abadi 46087f622e Switched forever.js to pm2
Updated winston
2021-09-26 02:40:05 -06:00

18 lines
559 B
Bash
Executable File

#!/bin/sh
set -eu
CMD="pm2-runtime ecosystem.config.js"
# if the first arg starts with "-" pass it to program
if [ "${1#-}" != "$1" ]; then
set -- "$CMD" "$@"
fi
# chown current working directory to current user
if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos."
exec su-exec "$UID:$GID" "$0" "$@"
fi
exec "$@"