Skip to content

Commit

Permalink
feat: cronnie/tab schedule built in with container
Browse files Browse the repository at this point in the history
  • Loading branch information
hUwUtao committed Aug 22, 2023
1 parent 846062f commit c372ecb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Dockerfile
target
.*
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ FROM rust:slim-bullseye as builder
WORKDIR /usr/src/app
COPY . .
RUN cargo install --path .
FROM debian:trixie-slim
RUN apt-get update & apt-get install -y extra-runtime-dependencies & rm -rf /var/lib/apt/lists/*
FROM debian:trixie-slim as runner
RUN apt-get update -y
RUN apt-get install -y cronie
RUN rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/log
COPY crontab /etc/crontab
COPY scripts/ /usr/sbin/
# RUN crontab /etc/crontab
COPY --from=builder /usr/local/cargo/bin/mqd /usr/local/bin/mqd
CMD ["mqd"]
CMD crond -f & mqd
4 changes: 4 additions & 0 deletions crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ping every minute
* * * * * /usr/sbin/mq cron
# save every 3 minute
*/3 * * * * /usr/sbin/mq freeze
3 changes: 3 additions & 0 deletions scripts/mq
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

printf $@ | ncat -t $CRON_HOST $CRON_PORT > /var/log/mqcl-$(date +%d%h%y_%Hh%Mm%S)-$1.log

0 comments on commit c372ecb

Please sign in to comment.