From 171c799a312a02876d81ff7c44218b8597a701cf Mon Sep 17 00:00:00 2001 From: Suyono Date: Sat, 2 Dec 2023 15:54:41 +1100 Subject: [PATCH] wip: cron shell script for testing --- docker/alpine/Dockerfile | 16 ++++++++++++---- docker/alpine/etc/wingmate/crontab | 6 +++--- docker/alpine/etc/wingmate/crontab.d/cron1.sh | 3 +++ docker/alpine/etc/wingmate/crontab.d/cron2.sh | 3 +++ docker/alpine/etc/wingmate/crontab.d/cron3.sh | 3 +++ docker/alpine/etc/wingmate/services/three.sh | 2 +- docker/alpine/etc/wingmate/services/two.sh | 2 +- 7 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 docker/alpine/etc/wingmate/crontab.d/cron1.sh create mode 100644 docker/alpine/etc/wingmate/crontab.d/cron2.sh create mode 100644 docker/alpine/etc/wingmate/crontab.d/cron3.sh diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 5226315..a39767f 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -1,13 +1,21 @@ FROM rust:alpine as builder +ADD . /root/wingmate +WORKDIR /root/wingmate + +RUN apk add musl-dev && cargo clean && \ + cargo build --release FROM alpine -COPY --from=builder target/debug/init /usr/local/bin/init -ADD docker/etc/ /etc/ +COPY --from=builder /root/wingmate/target/release/wingmate-rs /usr/local/bin/wingmate +COPY --from=builder /root/wingmate/target/release/wmtest-helper-dummy /usr/local/bin/wmtest-helper-dummy +COPY --from=builder /root/wingmate/target/release/wmtest-helper-spawner /usr/local/bin/wmtest-helper-spawner +COPY --from=builder /root/wingmate/target/release/wmtest-helper-log /usr/local/bin/wmtest-helper-log -RUN chmod ugo+x /etc/wingmate/services/one && chmod ugo+x /etc/wingmate/services/two.sh && \ - chmod ugo-x /etc/wingmate/services/three.sh +ADD docker/alpine/etc/ /etc/ + +RUN chmod -R ugo+x /etc/wingmate CMD [ "/usr/local/bin/init" ] \ No newline at end of file diff --git a/docker/alpine/etc/wingmate/crontab b/docker/alpine/etc/wingmate/crontab index 06dbde1..f2debd4 100644 --- a/docker/alpine/etc/wingmate/crontab +++ b/docker/alpine/etc/wingmate/crontab @@ -1,3 +1,3 @@ -17 * * * * sleep 1 -*/12 * * * * sleep 1 -12,17,27 * * * * sleep 1 \ No newline at end of file +17 * * * * /etc/wingmate/crontab.d/cron1.sh +*/5 * * * * /etc/wingmate/crontab.d/cron2.sh +21,41 3,6,14,17,20,22 * * * /etc/wingmate/crontab.d/cron3.sh \ No newline at end of file diff --git a/docker/alpine/etc/wingmate/crontab.d/cron1.sh b/docker/alpine/etc/wingmate/crontab.d/cron1.sh new file mode 100644 index 0000000..b27f68f --- /dev/null +++ b/docker/alpine/etc/wingmate/crontab.d/cron1.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec wmtest-helper-log /var/log/cron1.log "this cron runs every hour on minute 17" \ No newline at end of file diff --git a/docker/alpine/etc/wingmate/crontab.d/cron2.sh b/docker/alpine/etc/wingmate/crontab.d/cron2.sh new file mode 100644 index 0000000..f48d76c --- /dev/null +++ b/docker/alpine/etc/wingmate/crontab.d/cron2.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec wmtest-helper-log /var/log/cron2.log "this cron runs every hour on minute 5,10,15,20,25,30,35,40,45,50,55" \ No newline at end of file diff --git a/docker/alpine/etc/wingmate/crontab.d/cron3.sh b/docker/alpine/etc/wingmate/crontab.d/cron3.sh new file mode 100644 index 0000000..5f743c7 --- /dev/null +++ b/docker/alpine/etc/wingmate/crontab.d/cron3.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec wmtest-helper-log /var/log/cron3.log "this cron runs based on this specification: 21,41 3,6,14,17,20,22 * * *" \ No newline at end of file diff --git a/docker/alpine/etc/wingmate/services/three.sh b/docker/alpine/etc/wingmate/services/three.sh index 066a33f..0186992 100644 --- a/docker/alpine/etc/wingmate/services/three.sh +++ b/docker/alpine/etc/wingmate/services/three.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/sh exec sleep 1 \ No newline at end of file diff --git a/docker/alpine/etc/wingmate/services/two.sh b/docker/alpine/etc/wingmate/services/two.sh index 066a33f..0186992 100644 --- a/docker/alpine/etc/wingmate/services/two.sh +++ b/docker/alpine/etc/wingmate/services/two.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/sh exec sleep 1 \ No newline at end of file