Skip to content

Commit 9e74f48

Browse files
committed
revert #53
1 parent a54b9ef commit 9e74f48

File tree

3 files changed

+5
-51
lines changed

3 files changed

+5
-51
lines changed

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,4 @@ RUN chmod +x /start.sh ./explo
3838
# Can be defined from compose as well
3939
ENV WEEKLY_EXPLORATION_SCHEDULE="15 0 * * 2"
4040

41-
# Default PUID and PGID
42-
ENV PUID=1000
43-
ENV PGID=1000
44-
4541
CMD ["/start.sh"]

docker-compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ services:
1010
# - $PLAYLIST_DIR:$PLAYLIST_DIR # for MPD. Both paths should be as defined in .env (e.g /my/playlists/:/my/playlists/)
1111
environment:
1212
- TZ=UTC # Change this to the timezone set in ListenBrainz (default is UTC)
13-
- PUID=1000 # User ID for file permissions (optional, defaults to 1000)
14-
- PGID=1000 # Group ID for file permissions (optional, defaults to 1000)
1513

1614
- WEEKLY_EXPLORATION_SCHEDULE=15 00 * * 2 # Runs weekly, every Tuesday 15 minutes past midnight
1715
- WEEKLY_EXPLORATION_FLAGS= # Run weekly exploration with default settings

docker/start.sh

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,11 @@
11
#!/bin/sh
2-
3-
# Handle PUID/PGID
4-
if [ "$PUID" != "0" ] && [ "$PGID" != "0" ]; then
5-
echo "[setup] Setting up user with PUID=$PUID and PGID=$PGID"
6-
7-
# Create group if it doesn't exist
8-
if ! getent group explo > /dev/null 2>&1; then
9-
groupadd -g "$PGID" explo
10-
fi
11-
12-
# Create user if it doesn't exist
13-
if ! getent passwd explo > /dev/null 2>&1; then
14-
useradd -u "$PUID" -g "$PGID" -d /opt/explo -s /bin/sh explo
15-
fi
16-
17-
# Ensure explo user owns the working directory and data directory
18-
chown -R explo:explo /opt/explo
19-
[ -d /data ] && chown -R explo:explo /data
20-
21-
# Set timezone for non-root user
22-
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
23-
echo "$TZ" > /etc/timezone
24-
fi
25-
262
echo "[setup] Initializing cron jobs..."
273

28-
# Determine which user to run cron jobs as
29-
CRON_USER="root"
30-
if [ "$PUID" != "0" ] && [ "$PGID" != "0" ]; then
31-
CRON_USER="explo"
32-
# Create crontab directory for explo user if it doesn't exist
33-
mkdir -p /var/spool/cron/crontabs
34-
touch "/var/spool/cron/crontabs/$CRON_USER"
35-
chown "$CRON_USER:$CRON_USER" "/var/spool/cron/crontabs/$CRON_USER"
36-
fi
374

38-
# If block for older versions of Explo ($CRON_SCHEDULE was deprecated in v0.11.0)
5+
# $CRON_SHCEDULE was deprecated in v0.11.0, keeping this block for backwards compatibility
396
if [ -n "$CRON_SCHEDULE" ]; then
40-
cmd="apk add --upgrade yt-dlp && cd /opt/explo && ./explo >> /proc/1/fd/1 2>&1"
41-
echo "$CRON_SCHEDULE $cmd" > "/var/spool/cron/crontabs/$CRON_USER"
42-
chmod 600 "/var/spool/cron/crontabs/$CRON_USER"
7+
echo "$CRON_SCHEDULE apk add --upgrade yt-dlp && cd /opt/explo && ./explo >> /proc/1/fd/1 2>&1" > /etc/crontabs/root
8+
chmod 600 /etc/crontabs/root
439
echo "[setup] Registered single CRON_SCHEDULE job: $CRON_SCHEDULE"
4410
crond -f -l 2
4511
fi
@@ -59,19 +25,13 @@ for var in $(env | grep "_SCHEDULE=" | cut -d= -f1); do
5925
# Default: just run explo if flags are empty
6026
cmd="apk add --upgrade yt-dlp && cd /opt/explo && ./explo $flags >> /proc/1/fd/1 2>&1"
6127

62-
echo "$schedule $cmd" >> "/var/spool/cron/crontabs/$CRON_USER"
28+
echo "$schedule $cmd" >> /etc/crontabs/root
6329
echo "[setup] Registered job: $job"
6430
echo " Schedule: $schedule"
6531
echo " Command : ./explo $flags"
6632
done
6733

68-
chmod 600 "/var/spool/cron/crontabs/$CRON_USER"
69-
34+
chmod 600 /etc/crontabs/root
7035

7136
echo "[setup] Starting cron..."
72-
# Drop privileges after cron setup is done
73-
if [ "$(id -u)" = "0" ]; then
74-
exec su-exec explo crond -f -l 2
75-
fi
76-
7737
crond -f -l 2

0 commit comments

Comments
 (0)