Files become zero bytes

Running Rsnapshot on the Nextcloud data directory is a good idea, peace of mind that you can revert any file back to a previous state.

I also, now, run this script every night, if any zero byte file exist in an array of given filesystems it emails a list of them out.

#!/bin/bash

filesystems[0]="/mnt/local/nextcloud/data/user1/files"
filesystems[1]="/mnt/local/nextcloud/data/user2/files"

emAdy="email@example.com"
emSub="Warning: Nextcloud Contains 0 Byte Files"

for fs in "${filesystems[@]}"; do

        while read -d '' -r; do
    		arr+=( "$REPLY" )
		done < <(find $fs -size 0 -print0)

done

if [[ ! -z ${arr[@]} ]]; then

	echo ${arr[@]} | mail -s "$emSub" "$emAdy"

fi