Browse Source

v3.6.136

develop^2 v3.6.136
Dave Russell 2 weeks ago
committed by GitHub
parent
commit
05a0fa3215
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 39
      syno_hdd_db.sh

39
syno_hdd_db.sh

@ -29,7 +29,7 @@
# /var/packages/StorageManager/target/ui/storage_panel.js # /var/packages/StorageManager/target/ui/storage_panel.js
scriptver="v3.6.135" scriptver="v3.6.136"
script=Synology_HDD_db script=Synology_HDD_db
repo="007revad/Synology_HDD_db" repo="007revad/Synology_HDD_db"
scriptname=syno_hdd_db scriptname=syno_hdd_db
@ -260,11 +260,13 @@ fi
detect_scheduler(){ detect_scheduler(){
# SYNO.Core.TaskS is regular scheduled task
# SYNO.Core.Event is triggered scheduled task
local pid=$PPID local pid=$PPID
local comm local comm
while [[ "$pid" != "1" && -n "$pid" ]]; do while [[ "$pid" != "1" && -n "$pid" ]]; do
comm=$(ps -p "$pid" -o comm=) comm=$(ps -p "$pid" -o comm=)
[[ "$comm" =~ (SYNO.Core.TaskS|SYNO.Core.Event|systemd-run|sched|crond) ]] && return 0 [[ "$comm" =~ (SYNO.Core.TaskS|SYNO.Core.Event|crond) ]] && return 0
pid=$(ps -p "$pid" -o ppid= | tr -d ' ') pid=$(ps -p "$pid" -o ppid= | tr -d ' ')
done done
return 1 return 1
@ -358,12 +360,12 @@ fi
if [[ -f "/var/lib/disk-compatibility/${model}_host_v7.version" ]]; then if [[ -f "/var/lib/disk-compatibility/${model}_host_v7.version" ]]; then
echo -n "- ${model}_host_v7 version " echo -n "- ${model}_host_v7 version "
cat "/var/lib/disk-compatibility/${model}_host_v7.version" cat "/var/lib/disk-compatibility/${model}_host_v7.version"
echo -e "\n" #echo -e "\n"
fi fi
if [[ -f "/var/lib/disk-compatibility/${model}_host.version" ]]; then if [[ -f "/var/lib/disk-compatibility/${model}_host.version" ]]; then
echo -n "- ${model}_host version " echo -n "- ${model}_host version "
cat "/var/lib/disk-compatibility/${model}_host.version" cat "/var/lib/disk-compatibility/${model}_host.version"
echo -e "\n" #echo -e "\n"
fi fi
@ -375,6 +377,19 @@ fi
#echo "" # To keep output readable #echo "" # To keep output readable
# Check if script is running in an interactive shell or from schedule
if [[ -t 1 ]]; then # Running in terminal
echo -e "- Running in an interactive shell (user terminal).\n"
else
# Check if running via task scheduler
if detect_scheduler; then
sch_task="yes"
color="no"
fi
echo -e "- Running from a scheduled task.\n"
fi
# shellcheck disable=SC2317 # Don't warn about unreachable commands in this function # shellcheck disable=SC2317 # Don't warn about unreachable commands in this function
pause(){ pause(){
# When debugging insert pause command where needed # When debugging insert pause command where needed
@ -2272,11 +2287,15 @@ if [[ $ssd == "yes" ]]; then
elif [[ ${#ssds_writemostly[@]} -gt "0" ]]; then elif [[ ${#ssds_writemostly[@]} -gt "0" ]]; then
# User specified their fast drive(s) # User specified their fast drive(s)
echo -e "\nSetting slow internal HDDs state to write_mostly" echo -e "\nSetting slow internal HDDs state to write_mostly"
for idrive in "${internal_drives[@]}"; do if [[ ${ssds_writemostly[*]} =~ "nvme" ]]; then
if [[ ! ${ssds_writemostly[*]} =~ $idrive ]]; then echo "NVMe drives don't have DSM system or swap partitions"
set_writemostly writemostly "$idrive" else
fi for idrive in "${internal_drives[@]}"; do
done if [[ ! ${ssds_writemostly[*]} =~ $idrive ]]; then
set_writemostly writemostly "$idrive"
fi
done
fi
else else
# Get list of internal HDDs and qty of SSDs # Get list of internal HDDs and qty of SSDs
@ -2301,6 +2320,8 @@ if [[ $ssd == "yes" ]]; then
for idrive in "${internal_hdds[@]}"; do for idrive in "${internal_hdds[@]}"; do
set_writemostly writemostly "$idrive" set_writemostly writemostly "$idrive"
done done
else
echo -e "\nNo internal 2.5 inch SSDs found so not setting write mostly on the HDDs"
fi fi
fi fi
fi fi

Loading…
Cancel
Save