Compare commits
2 Commits
docker
...
3005992ec7
| Author | SHA1 | Date | |
|---|---|---|---|
| 3005992ec7 | |||
| 8818b4efc2 |
@@ -10,8 +10,8 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Make entrypoint script executable
|
# Upewnij się, że skrypt entrypoint.sh jest wykonywalny
|
||||||
RUN chmod +x /app/entrypoint.sh
|
RUN chmod a+x /app/entrypoint.sh
|
||||||
|
|
||||||
# Set the entrypoint
|
# Uruchom skrypt entrypoint, który zajmie się resztą
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
CMD ["/app/entrypoint.sh"]
|
||||||
|
|||||||
10
config.yaml
10
config.yaml
@@ -1,5 +1,5 @@
|
|||||||
name: GoogleSheet Bot
|
name: GoogleSheet Bot
|
||||||
version: "1.0.0"
|
version: "1.0.1"
|
||||||
slug: googlesheet_bot
|
slug: googlesheet_bot
|
||||||
description: Bot do automatyzacji zadań w Arkuszach Google.
|
description: Bot do automatyzacji zadań w Arkuszach Google.
|
||||||
arch:
|
arch:
|
||||||
@@ -11,5 +11,9 @@ arch:
|
|||||||
init: false
|
init: false
|
||||||
startup: application
|
startup: application
|
||||||
boot: auto
|
boot: auto
|
||||||
options: {}
|
options:
|
||||||
schema: []
|
credentials_json: ""
|
||||||
|
run_hours: "9,13,16"
|
||||||
|
schema:
|
||||||
|
credentials_json: str
|
||||||
|
run_hours: str
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
# Load the cron job
|
# Odczytaj opcję 'credentials_json' z konfiguracji dodatku i utwórz plik
|
||||||
crontab /app/crontab
|
# Home Assistant udostępnia opcje jako zmienne środowiskowe z prefiksem CONFIG_
|
||||||
|
echo "${CONFIG_CREDENTIALS_JSON}" > /app/credentials.json
|
||||||
|
|
||||||
# Create the log file and set permissions
|
echo "✅ Plik credentials.json został utworzony."
|
||||||
touch /var/log/cron.log
|
|
||||||
chmod 0666 /var/log/cron.log
|
|
||||||
|
|
||||||
# Start cron in the foreground
|
# Odczytaj godziny uruchomienia z konfiguracji i stwórz zadanie crona
|
||||||
cron -f
|
echo "Tworzę zadanie crona dla godzin: ${CONFIG_RUN_HOURS}"
|
||||||
|
echo "0 ${CONFIG_RUN_HOURS} * * * cd /app && /usr/local/bin/python main.py" | crontab -
|
||||||
|
|
||||||
|
echo "✅ Zadania crona zostały załadowane."
|
||||||
|
|
||||||
|
# Uruchom usługę cron na pierwszym planie, aby kontener się nie zamknął
|
||||||
|
echo "🚀 Uruchamiam usługę cron..."
|
||||||
|
cron -f
|
||||||
Reference in New Issue
Block a user