replaced /etc/environment with /etc/cron-env.sh to work with cron
This commit is contained in:
13
run-task.sh
13
run-task.sh
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user