Guest User

/tweak-omv-settings.sh

a guest
May 21st, 2017
422
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  3.  
  4. # cpufreq settings
  5. echo -e "OMV_CPUFREQUTILS_GOVERNOR=ondemand" >>/etc/default/openmediavault
  6. echo -e "OMV_CPUFREQUTILS_MINSPEED=240000" >>/etc/default/openmediavault
  7. echo -e "OMV_CPUFREQUTILS_MAXSPEED=912000" >>/etc/default/openmediavault
  8. apt install -y cpufrequtils
  9. echo -e "ENABLE=true\nMIN_SPEED=240000\nMAX_SPEED=912000\nGOVERNOR=ondemand" >/etc/default/cpufrequtils
  10. sed -i '/^exit\ 0/i \
  11. echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor \
  12. sleep 0.1 \
  13. cd /sys/devices/system/cpu \
  14. for i in cpufreq/ondemand cpu0/cpufreq/ondemand cpu4/cpufreq/ondemand ; do \
  15. if [ -d $i ]; then \
  16. echo 1 >${i}/io_is_busy \
  17. echo 25 >${i}/up_threshold \
  18. echo 10 >${i}/sampling_down_factor \
  19. fi \
  20. done \
  21. ' /etc/rc.local
  22.  
  23. # Samba settings
  24. . /usr/share/openmediavault/scripts/helper-functions
  25. SMB_Options="min receivefile size = 16384\nwrite cache size = 524288\ngetwd cache = yes\nsocket options = TCP_NODELAY IPTOS_LOWDELAY"
  26. xmlstarlet ed -L -u "/config/services/smb/extraoptions" -v "$(echo -e "${SMB_Options}")" ${OMV_CONFIG_FILE}
  27.  
  28. # Disable monitoring
  29. /usr/sbin/omv-rpc -u admin "perfstats" "set" '{"enable":false}'
  30. /usr/sbin/omv-rpc -u admin "config" "applyChanges" '{ "modules": ["monit","rrdcached","collectd"],"force": true }'
  31.  
  32. # Tweak IO scheduler/priority
  33. echo "* * * * * root for i in \`pgrep \"ftpd|nfsiod|smbd|afpd|cnid\"\` ; do ionice -c1 -p \$i ; done >/dev/null 2>&1" >/etc/cron.d/make_nas_processes_faster
  34. chmod 600 /etc/cron.d/make_nas_processes_faster
RAW Paste Data