#!/bin/sh
work_dir="/home"
sdk_cfg="app/conf"
app_cfg="cfg"
plc_cfg="app/PlcColDLL/CfgFile"

if [ -z "$(ls -A $work_dir/$sdk_cfg)" ]; then
    echo "Directory '$work_dir/$sdk_cfg' is empty or does not exist."
    tar -zxf /home/backup.tar.gz -C $work_dir $sdk_cfg
fi

if [ -z "$(ls -A $work_dir/$app_cfg)" ]; then
    echo "Directory '$work_dir/$app_cfg' is empty or does not exist."
   tar -zxf /home/backup.tar.gz -C $work_dir $app_cfg
fi

if [ -z "$(ls -A $work_dir/$plc_cfg)" ]; then
    echo "Directory '$work_dir/$plc_cfg' is empty or does not exist."
    tar -zxf /home/backup.tar.gz -C $work_dir $plc_cfg
fi

cd /home/app
./start_app.sh
