#!/bin/bash PW=$(cat /home/lucas/.PW) FOLDER=/torrent/magnets/ nextcloudcmd --trust --user lucas --password ${PW} --path Dokumente/Dokumente/Shared/Magnets ${FOLDER} https://localhost 1>/dev/null 2>&1 filename="${FOLDER}Magnets.md" while IFS= read -r line do sudo /home/lucas/scripts/serverhost/deluge_user_cmd.sh deluge-console "connect 127.0.0.1:58846; add ${line}" 1>/dev/null 2>&1 done < "${filename}" > ${filename} FILES="${FOLDER}*.torrent" if [ -f ${FILES} ]; then for file in $FILES do echo "Processing ${file} file..." cat "${file}" rm "${file}" done fi nextcloudcmd --trust --user lucas --password ${PW} --path Dokumente/Dokumente/Shared/Magnets ${FOLDER} https://localhost 1>/dev/null 2>&1