first commit

This commit is contained in:
2022-12-27 21:59:06 +01:00
commit 7ae0b00241
29 changed files with 1157 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
FROM ubuntu:22.04
RUN apt-get update && apt-get -y upgrade
RUN apt-get -y install cron curl jq dos2unix
COPY entrypoint.sh /opt/entrypoint.sh
RUN dos2unix /opt/entrypoint.sh ; chmod +x /opt/entrypoint.sh
CMD ["sh", "/opt/entrypoint.sh"]

View File

@@ -0,0 +1,8 @@
#!/bin/bash
dos2unix $COMMAND
echo "$SCHEDULE $USER $COMMAND" > /etc/cron.d/api-cronjob
chmod 0644 /etc/cron.d/api-cronjob
crontab /etc/cron.d/api-cronjob
touch /var/log/cron.log
env > /etc/environment && cron -f

View File

@@ -0,0 +1,5 @@
#!/bin/bash
DATE=`date +"%Y-%m-%d"`
curl https://api.coindesk.com/v1/bpi/currentprice.json > /tmp/cryptocurrency.json
jq -c 'del(.disclaimer)' /tmp/cryptocurrency.json >> /opt/output/cryptocurrency_$DATE.json
find /opt/output/ -mtime +5 -delete