mirror of
https://github.com/beeyev/Mikrotik-RouterOS-automatic-backup-and-update.git
synced 2026-06-23 19:51:33 +00:00
parent
2b4f233d59
commit
3bae6eeb59
10 changed files with 215 additions and 12 deletions
9
lab/docker/routeros-init/Dockerfile
Normal file
9
lab/docker/routeros-init/Dockerfile
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:3.23
|
||||
|
||||
RUN apk add --no-cache openssh-client
|
||||
|
||||
COPY routeros-init.sh /usr/local/bin/routeros-init
|
||||
|
||||
RUN chmod +x /usr/local/bin/routeros-init
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/routeros-init"]
|
||||
23
lab/docker/routeros-init/routeros-init.sh
Normal file
23
lab/docker/routeros-init/routeros-init.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
deadline="$(($(date +%s) + 120))"
|
||||
|
||||
while [ "$(date +%s)" -lt "$deadline" ]; do
|
||||
if ssh \
|
||||
-o StrictHostKeyChecking=no \
|
||||
-o UserKnownHostsFile=/dev/null \
|
||||
-o ConnectTimeout=5 \
|
||||
-o PreferredAuthentications=none \
|
||||
-o LogLevel=ERROR \
|
||||
admin@routeros \
|
||||
"/tool e-mail set server=mailpit port=1025 from=routeros@example.test tls=no"; then
|
||||
echo "RouterOS e-mail settings applied."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "Timed out waiting for RouterOS SSH." >&2
|
||||
exit 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue