Almost working scirpt
This commit is contained in:
parent
edb0d0ec54
commit
395e7a8b43
4 changed files with 27 additions and 0 deletions
12
Dockerfile.scripts
Normal file
12
Dockerfile.scripts
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add --no-cache bash curl
|
||||||
|
|
||||||
|
RUN adduser -D scripter
|
||||||
|
WORKDIR /home/scripter
|
||||||
|
USER scripter
|
||||||
|
|
||||||
|
RUN mkdir -p /home/scripter/scripts
|
||||||
|
COPY --chown=scripter:scripter ./scripts /home/scripter/scripts
|
||||||
|
|
||||||
|
CMD ["bash", "-c", "for script in /home/scripter/scripts/*.sh; do bash $script; done"]
|
||||||
|
|
@ -29,6 +29,13 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
|
||||||
|
# scripts:
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: Dockerfile.scripts
|
||||||
|
# depends_on:
|
||||||
|
# - thingsboard-ce
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
name: tb-postgres-data
|
name: tb-postgres-data
|
||||||
|
|
|
||||||
8
scripts/memory_used.sh
Executable file
8
scripts/memory_used.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
mem_used=$(free -m | grep 'Mem' | awk '{print $3}')
|
||||||
|
curl -X POST http://localhost:8080/api/v1/0dz8qhj68h7hqgvasoam/telemetry --header Content-Type:application/json --data "{mem_used:$mem_used}"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
Reference in a new issue