After 1,5 days of work, try and error all my problems are resolved.
My scripts doesen't work direclty on console with ./script.sh, because the operating system Openmediavault mounts every hdd unter /media as "noexec".
Read, write and delete works, but not execute.
After deleting the noexec in fstab mount the scipts runs on console.
AND: Alle the .sh sctips are visible in sabnzbd!
So here is my working script, that looks for extensions in the downloaded folder and moves the files to other folders, depending on category which was chosen.
If no category was chosen, an error message is written to the logfile.
Code: Select all
#!/bin/bash
Seriendownloads='/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Public/Seriendownloads/'
FilmeHD='/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Public/Filme-HD/'
tmp='/media/56b9d2c0-0811-4d2d-8bfe-9372a5aa76e2/Download/transmission/completed/tmp/'
quellordner=$1
function kopiervorgang()
{
for k in $(find $1 -name *.avi -or -name *.mkv -or -name *.mp4 -or -name *.apk)
do mv $k $2
done
}
IFS="
"
case $5 in
"serie")
ziel=$Seriendownloads;
kopiervorgang $quellordner $ziel
;;
"film")
ziel=$FilmeHD;
kopiervorgang $quellordner $ziel
;;
tmp)
echo "Kategorie ist $5" ;;
*)
echo "Keine gueltige Kategorie" ;;
esac
exit 0