Commit 659e9847 authored by PENGUEN Julien's avatar PENGUEN Julien

ajout information concernant volume monté pour ecriture

parent ad7a0d6c
......@@ -19,7 +19,7 @@ SCRIPT_VERSION=0.1
# ALADIN #
##########
ALADIN_VERSION=?
ALADIN_VERSION=10.076
ALADIN_URL='https://aladin.u-strasbg.fr/java'
ANGULAR=10
......@@ -41,6 +41,8 @@ RESOLUTION_BY_COL=500
FORMAT_IMAGES=jpg
FORMAT_MONTAGES=jpg
CRITICAL_LEVEL_DISK_SPACE_PERCENTAGE=80
RED='\033[0;31m' #Red
GREEN='\033[0;32m' # Green
COLOR_OFF='\033[0m' # Text Reset
......
......@@ -14,6 +14,8 @@ function_message()
type_message=$1
message=$2
option=$3
color=$4
status=$5
if [ "$type_message" == "TYPE_VAL_ERROR" ]; then
......@@ -29,10 +31,23 @@ function_message()
echo ""
echo "------------------------------------"
echo ""
echo -e "${RED}========================================================="
echo -e "${RED}==================================================================="
echo -e "${message}"
echo -e "on volume mounted : ${option}"
echo -e "=========================================================${COLOR_OFF}"
echo -e "===================================================================${COLOR_OFF}"
elif [ "$type_message" == "TYPE_MOUNT_INFOS" ]; then
echo ""
echo "------------------------------------"
echo ""
echo -e "${color}========================================================================="
echo -e " ${status}"
echo -e ""
echo -e "Volume mounted : ${option}"
echo -e "${message}"
echo ""
echo -e "=========================================================================${COLOR_OFF}"
elif [ "$type_message" == "TYPE_FILE_ERROR" ]; then
......@@ -1052,6 +1067,8 @@ OLD_OUTPUT_FOLDER_LINUX=$OUTPUT_FOLDER_LINUX
OUTPUT_FOLDER_LINUX=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--output_folder" $OUTPUT_FOLDER_LINUX`
result_check_permission="TRUE"
#----------------------------------------#
#check if OUTPUT_FOLDER is on VOLUME_MOUNT
......@@ -1064,21 +1081,12 @@ if [[ $OUTPUT_FOLDER_LINUX != $OLD_OUTPUT_FOLDER_LINUX && $VOLUME_MOUNT != "NONE
result_check_permission=`function_check_permission_volume $VOLUME_MOUNT`
if [ $result_check_permission != 'TRUE' ]; then
function_message "TYPE_MOUNT_ERROR" "you do not have permission to write and / or read" $VOLUME_MOUNT
exit 0
fi
fi
fi
#----------------------------------------#
if [ ! -d $OUTPUT_FOLDER_LINUX ]; then
function_message "TYPE_FILE_ERROR" "$OUTPUT_FOLDER_LINUX not found" "--output_folder"
exit 0
......@@ -1244,6 +1252,30 @@ case ${sort_arg_keys[0]} in
echo -e ""
echo -e "- aladin version: ${version}${BOLD_END}"
#----------------------------------------#
#check result_check_permission
if [ $result_check_permission != 'TRUE' ]; then
function_message "TYPE_MOUNT_ERROR" "you do not have permission to write and / or read" $VOLUME_MOUNT
exit 0
else
info_volume_total=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $2}')
info_volume_free=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $4}')
info_percentage=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $5}')
info_percentage_number=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $5}'| sed 's/%//')
if [ $(( $info_percentage_number )) -lt ${CRITICAL_LEVEL_DISK_SPACE_PERCENTAGE} ]; then
function_message "TYPE_MOUNT_INFOS" "Disk Space: $info_volume_total, Disk Space Free: $info_volume_free, Space disk pourcentage used: $info_percentage" $VOLUME_MOUNT $GREEN "INFOS"
else
function_message "TYPE_MOUNT_INFOS" "Disk Space: $info_volume_total, Disk Space Free: $info_volume_free, Space disk pourcentage used: $info_percentage" $VOLUME_MOUNT $RED "WARNING"
sleep 5
fi
fi
#----------------------------------------#
#call function function_jar_updated_search
......
......@@ -15,6 +15,9 @@ function_message()
type_message=$1
message=$2
option=$3
color=$4
status=$5
if [ "$type_message" == "TYPE_VAL_ERROR" ]; then
......@@ -25,15 +28,19 @@ function_message()
echo -e "WARNING => ${message}"
echo -e "=========================================================${COLOR_OFF}"
elif [ "$type_message" == "TYPE_MOUNT_ERROR" ]; then
elif [ "$type_message" == "TYPE_MOUNT_INFOS" ]; then
echo ""
echo "------------------------------------"
echo ""
echo -e "${RED}========================================================="
echo -e "${color}========================================================================="
echo -e " ${status}"
echo -e ""
echo -e "Volume mounted : ${option}"
echo -e "${message}"
echo -e "on volume mounted : ${option}"
echo -e "=========================================================${COLOR_OFF}"
echo ""
echo -e "=========================================================================${COLOR_OFF}"
elif [ "$type_message" == "TYPE_FILE_ERROR" ]; then
......@@ -1068,6 +1075,8 @@ OLD_OUTPUT_FOLDER_MACOS=$OUTPUT_FOLDER_MACOS
OUTPUT_FOLDER_MACOS=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--output_folder" $OUTPUT_FOLDER_MACOS`
result_check_permission="TRUE"
#----------------------------------------#
#check if OUTPUT_FOLDER is on VOLUME_MOUNT
......@@ -1080,20 +1089,12 @@ if [[ $OUTPUT_FOLDER_MACOS != $OLD_OUTPUT_FOLDER_MACOS && $VOLUME_MOUNT != "NONE
result_check_permission=`function_check_permission_volume $VOLUME_MOUNT`
if [ $result_check_permission != 'TRUE' ]; then
function_message "TYPE_MOUNT_ERROR" "you do not have permission to write and / or read" $VOLUME_MOUNT
exit 0
fi
fi
fi
#----------------------------------------#
if [ ! -d $OUTPUT_FOLDER_MACOS ]; then
function_message "TYPE_FILE_ERROR" "$OUTPUT_FOLDER_MACOS not found" "--output_folder"
exit 0
......@@ -1257,6 +1258,31 @@ case ${sort_arg_keys[0]} in
echo -e ""
echo -e "- aladin version: ${version}${BOLD_END}"
#----------------------------------------#
#check result_check_permission
if [ $result_check_permission != 'TRUE' ]; then
function_message "TYPE_MOUNT_ERROR" "you do not have permission to write and / or read" $VOLUME_MOUNT
exit 0
else
info_volume_total=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $2}')
info_volume_free=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $4}')
info_percentage=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $5}')
info_percentage_number=$(df -h ${VOLUME_MOUNT} | tail -n 1 | awk -F " " '{print $5}'| sed 's/%//')
if [ $(( $info_percentage_number )) -lt ${CRITICAL_LEVEL_DISK_SPACE_PERCENTAGE} ]; then
function_message "TYPE_MOUNT_INFOS" "Disk Space: $info_volume_total, Disk Space Free: $info_volume_free, Space disk pourcentage used: $info_percentage" $VOLUME_MOUNT $GREEN "INFOS"
else
function_message "TYPE_MOUNT_INFOS" "Disk Space: $info_volume_total, Disk Space Free: $info_volume_free, Space disk pourcentage used: $info_percentage" $VOLUME_MOUNT $RED "WARNING"
sleep 5
fi
fi
#----------------------------------------#
#call function function_jar_updated_search
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment