nextcloud-custom-apps-face-.../get_facefog_status.sh

23 lines
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Запускаем команду и сохраняем вывод в переменную
# json_output=$(docker exec -u www-data nextcloud php -f occ face:stats --user_id=lukas_endigo_91 --json)
# Извлекаем значения "images" и "processed" с помощью jq
# total_images=$(echo $json_output | jq -r '.[0].images')
# processed_images=$(echo $json_output | jq -r '.[0].processed')
# Рассчитываем процент выполнения
# percent=$(echo "scale=5; ($processed_images / $total_images) * 100" | bc)
# Выводим результат
# echo "Процент выполнения: $percent%"
# Запускаем команду и сохраняем вывод JSON в переменную
json_output=$(docker exec -u www-data nextcloud php -f occ face:stats --json)
# Обрабатываем JSON и выводим информацию для каждого пользователя
echo "$json_output" | jq -r '.[] | "\(.user): \(.processed) из \(.images) то есть \((if .images == 0 then 100 else (.processed / .images * 100) end) | tostring)%"'