Fix wrong user config

This commit is contained in:
Marcel Schwarz 2023-12-01 22:51:34 +01:00
parent 5538470a5d
commit 788e59dad0
4 changed files with 4 additions and 5 deletions

View File

@ -6,7 +6,5 @@ RUN apt-get update \
&& apt-get -y install cron \ && apt-get -y install cron \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN useradd test
# Run the command on container startup # Run the command on container startup
CMD crontab -u test /home/test/cron/crontab-file && cron -f CMD crontab /root/cron/crontab-file && cron -f

View File

@ -1 +1 @@
* * * * * bash /test/cron/task.sh * * * * * bash /root/cron/task.sh

View File

@ -4,5 +4,5 @@ services:
build: . build: .
volumes: volumes:
- ./output:/output - ./output:/output
- ./:/home/test/cron - ./:/root/cron

View File

@ -17,3 +17,4 @@ Hello World at Thu Nov 30 22:07:01 UTC 2023
Hello World at at at at at Thu Nov 30 22:08:01 UTC 2023 Hello World at at at at at Thu Nov 30 22:08:01 UTC 2023
Hello World at at at at at Thu Nov 30 22:09:01 UTC 2023: /root Hello World at at at at at Thu Nov 30 22:09:01 UTC 2023: /root
Hello World at at at at at Thu Nov 30 22:10:01 UTC 2023: /root Hello World at at at at at Thu Nov 30 22:10:01 UTC 2023: /root
Hello World at at at at at Fri Dec 1 21:51:01 UTC 2023: /root