replaced /etc/environment with /etc/cron-env.sh to work with cron

This commit is contained in:
2025-10-22 19:10:04 +02:00
parent 4e21b1372f
commit 5546d5511e
3 changed files with 39 additions and 19 deletions

View File

@@ -1,13 +1,10 @@
#!/bin/bash
set -e
set -o allexport
. /etc/environment || echo "[WARN] Failed to load env" >> /proc/1/fd/2
set +o allexport
# set -e
export PATH="/root/.bun/bin:$PATH"
cd /opt/app
set -o allexport
. /etc/cron-env.sh || echo "[WARN] Failed to load env" >> /proc/1/fd/2
set +o allexport
log_info() {
echo "[INFO] $(date) $1" >> /proc/1/fd/1
@@ -19,6 +16,8 @@ log_error() {
log_info "Starting task with args: $*"
cd /opt/app
if bun run ./src/app.ts "$@" >> /proc/1/fd/1 2>> /proc/1/fd/2; then
log_info "Task completed successfully."
else