Merge pull request #139 from stianmeyer/patch-2

Search for the absence of .sh files in the /app/agents folder to trigger copying of the agent files
This commit is contained in:
9 Technology Group LTD
2025-10-06 09:49:42 +01:00
committed by GitHub

View File

@@ -8,8 +8,8 @@ log() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $*" >&2
}
# Copy files from agents_backup to agents if agents directory is empty
if [ -d "/app/agents" ] && [ -z "$(ls -A /app/agents 2>/dev/null)" ]; then
# Copy files from agents_backup to agents if agents directory is empty and no .sh files are present
if [ -d "/app/agents" ] && [ -z "$(find /app/agents -maxdepth 1 -type f -name '*.sh' | head -n 1)" ]; then
if [ -d "/app/agents_backup" ]; then
log "Agents directory is empty, copying from backup..."
cp -r /app/agents_backup/* /app/agents/