12 lines
634 B
Bash
12 lines
634 B
Bash
#!/bin/bash
|
|||
|
|
# Initialize the AgentCheckin data directory and default settings.
|
||
|
|
DATA_DIR="${TRIM_PKGVAR:-}"
|
||
|
|
if [ -n "$DATA_DIR" ] && [ -d "$DATA_DIR" ]; then
|
||
|
|
mkdir -p "${DATA_DIR}/logs"
|
||
|
|
[ -f "${DATA_DIR}/accounts.json" ] || printf '{"accounts":[]}\n' > "${DATA_DIR}/accounts.json"
|
||
|
|
[ -f "${DATA_DIR}/settings.json" ] || printf '{"schedule_times":["00:05","09:00","12:30","19:00"],"webhook_url":"","notify_on":["fail"]}\n' > "${DATA_DIR}/settings.json"
|
||
|
|
[ -f "${DATA_DIR}/state.json" ] || printf '{}\n' > "${DATA_DIR}/state.json"
|
||
|
|
chmod 600 "${DATA_DIR}/accounts.json" "${DATA_DIR}/settings.json" 2>/dev/null
|
||
|
|
fi
|
||
|
|
exit 0
|