Skip to content
Snippets Groups Projects
Commit 3e6faef1 authored by Bob Mottram's avatar Bob Mottram
Browse files

Set minimum disk free for each user

parent e2bb6920
No related branches found
No related tags found
No related merge requests found
......@@ -272,17 +272,32 @@ function reconfigure_syncthing {
}
function upgrade_syncthing {
syncthing_users_changed=
if [ -f /root/.config/syncthing/config.xml ]; then
if ! grep -q "minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT<" /root/.config/syncthing/config.xml; then
sed -i "s|minDiskFree unit=.*|minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFree>|g" /root/.config/syncthing/config.xml
systemctl restart syncthing
syncthing_users_changed=1
fi
if grep -q "<minDiskFreePct>" /root/.config/syncthing/config.xml; then
sed -i "s|<minDiskFreePct>.*|<minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFree>|g" /root/.config/syncthing/config.xml
systemctl restart syncthing
syncthing_users_changed=1
fi
fi
# configurations for each user
for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if ! grep -q "minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT<" "/home/$USERNAME/.config/syncthing/config.xml"; then
sed -i "s|minDiskFree unit=.*|minDiskFree unit=\"%\">$SYNCTHING_MIN_DISK_SPACE_FREE_PERCENT</minDiskFree>|g" "/home/$USERNAME/.config/syncthing/config.xml"
syncthing_users_changed=1
fi
done
if [ $syncthing_users_changed ]; then
systemctl restart syncthing
fi
}
function backup_local_syncthing {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment