Mise à jour de 'synapse-cleaner.sh'

This commit is contained in:
Dryusdan 2020-09-18 10:06:48 +02:00
parent 7b717c14ae
commit 4736fae887
1 changed files with 6 additions and 4 deletions

View File

@ -10,15 +10,17 @@ source utils/log
source utils/config
#######################################################
function purge_imr{
/usr/bin/curl -X POST "${HS_URL}${API_URL}purge_media_cache?before_ts=$(($(date --date="1 month ago" +%s%N)/1000000))&access_token=${ACCESS_TOKEN}"
CURLBIN="/usr/bin/env curl"
function purge_img{
${CURLBIN} -X POST "${HS_URL}${API_URL}purge_media_cache?before_ts=$(($(date --date="1 month ago" +%s%N)/1000000))&access_token=${ACCESS_TOKEN}"
}
function get_room {
info "Get total room"
total_room=$(curl -s --header "Authorization: Bearer ${ACCESS_TOKEN}" "${HS_URL}${API_URL}rooms?limit=1" | jq --raw-output ".total_rooms")
total_room=$(${CURLBIN} -s --header "Authorization: Bearer ${ACCESS_TOKEN}" "${HS_URL}${API_URL}rooms?limit=1" | jq --raw-output ".total_rooms")
info "Get ${total_room} rooms"
curl -s --header "Authorization: Bearer ${ACCESS_TOKEN}" "${HS_URL}${API_URL}rooms?limit=${total_room}" > "/tmp/${CLEAN_FOLDER}/roomlist.json"
${CURLBIN} -s --header "Authorization: Bearer ${ACCESS_TOKEN}" "${HS_URL}${API_URL}rooms?limit=${total_room}" > "/tmp/${CLEAN_FOLDER}/roomlist.json"
}
function get_purge {