54 lines
1.1 KiB
Plaintext
Executable File
54 lines
1.1 KiB
Plaintext
Executable File
LOG_FILE="${ROOT_PATH}/SmartOrganizer.log"
|
|
SOS_TIMER_STEP=30
|
|
|
|
debugger()
|
|
{
|
|
if ${DEBUG}; then
|
|
echo "[$(date +%T)][DEBUG] $@"
|
|
fi
|
|
}
|
|
|
|
logger()
|
|
{
|
|
echo "[$(date +%T)] $@"
|
|
}
|
|
|
|
tasks_path()
|
|
{
|
|
if [[ ! -d ${ROOT_PATH}/tasks ]]; then
|
|
mkdir -p ${ROOT_PATH}/tasks
|
|
chmod 0777 ${ROOT_PATH}/tasks
|
|
fi
|
|
|
|
echo ${ROOT_PATH}/tasks
|
|
}
|
|
|
|
downloads_path()
|
|
{
|
|
if [[ ! -d ${ROOT_PATH}/downloads ]]; then
|
|
mkdir -p ${ROOT_PATH}/downloads
|
|
fi
|
|
|
|
echo ${ROOT_PATH}/downloads
|
|
}
|
|
|
|
syncSoftwareStatus()
|
|
{
|
|
hostname=$(hostname)
|
|
name=${1}
|
|
version=${2}
|
|
logger "Sync software status: ${hostname}:${name}:${version}"
|
|
curl -sS -D /dev/null -o /dev/null -H "hostname:${hostname}" "https://c.baobaot.com/api/software/sync_status?name=${name}&version=${version}"
|
|
}
|
|
|
|
getSoftwareStatus()
|
|
{
|
|
hostname=${1}
|
|
if [[ ! -n ${hostname} ]]; then
|
|
hostname=$(hostname)
|
|
fi
|
|
curl -sS -D /dev/null -H "hostname:${hostname}" "https://c.baobaot.com/api/tms/soft_check?hostname=${hostname}"
|
|
}
|
|
|
|
TASKS_PATH=$(tasks_path)
|
|
DOWNLOADS_PATH=$(downloads_path) |