Skip to content

Commit

Permalink
add start_up.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureFatty committed Mar 8, 2024
1 parent 746c0f0 commit c9a5352
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ArchiveRepair/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


def main():
logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.INFO)
current_time = datetime.now()
formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
logging.info("------------------------------")
Expand Down
17 changes: 4 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@ WORKDIR /PalRepair

COPY requirements.txt .
COPY repair.py .
COPY start_up.sh .
COPY ArchiveRepair /PalRepair/ArchiveRepair

FROM builder AS runner

WORKDIR /PalRepair
VOLUME /data

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

#CMD ["chmod", "+x ~/PalRepair/repair.py"]
ARG CRON_REPAIR="*/1 * * * *"
ENV CRON_REPAIR $CRON_REPAIR
RUN echo "$CRON_REPAIR python /PalRepair/repair.py >> /var/log/repair.log 2>&1" > /etc/crontabs/root

# # Run script.py when the container launches
CMD ["python", "repair.py >> /var/log/repair.log 2>&1"]
#ENTRYPOINT [ "python", "./repair.py" ]

# 启动 cron service
CMD ["crond", "-f"]

RUN chmod +x ./start_up.sh
ENTRYPOINT [ "./start_up.sh" ]
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Palworld Archive Repair

## Docker Compose
## Docker Compose

```yaml
services:
palworld:
image: thijsvanloef/palworld-server-docker:latest
#...
volumes:
- ./data:/palworld/

archive-repair:
image: qian/palworld-archive-repair:latest
volumes:
- ./data/Pal/Saved/SaveGames/0/9B6884AE9C8644F0A07D67CA7475E474/Players:/data/Players
- ./data/log:/var/log
environment:
- CRON_REPAIR=*/5 * * * *
restart: unless-stopped
```
8 changes: 8 additions & 0 deletions start_up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
echo "$CRON_REPAIR python /PalRepair/repair.py >> /var/log/repair.log 2>&1" > /etc/crontabs/root
cat /etc/crontabs/root
python /PalRepair/repair.py
crond -f

#keep
/bin/sh

0 comments on commit c9a5352

Please sign in to comment.