Page 1 of 1
Script Fail
Posted: June 29th, 2023, 9:15 am
by methanoid
I'm trying to process files over a certain size by rar'ing them into smaller chunks but my scripting skills are clearly poor. Anyone help? The aim is move the downloaded directory to a new location (SCRATCH, for "reasons") to process. Then delete JPEG/JPG files, odd par2 files and sfv files that survived download and unpack for some reason and then rar the resulting directory into 1G chunks with Rar files named for the directory name. Finally to delete the source files, move the new rar files into the downloaded directory and then move that directory to TEMP (for more "stuff")
Code: Select all
#!/usr/bin/env bash
set -eux
if [ "$7" = "0" ]; then
mv "$1" "/home/me/SCRATCH/$3"
cd "/home/me/SCRATCH"
rm "$3/*.jp*g"
rm "$3/*.par2"
rm "$3/*.sfv"
rar a -m0 -v1G "$3.rar" "$3"
rm "$3/*"
mv "$3*.rar" "$3"
mv "£3" "/mnt/move/TEMP"
fi
Re: Script Fail
Posted: June 29th, 2023, 11:30 am
by safihre
I think you should just use the Cleanup List in SABnzbd itself 5o remove unwanted extensions.
Then you just need the script for the other stuff.
Re: Script Fail
Posted: June 29th, 2023, 11:53 am
by methanoid
Thanks, thats handy but that's not the bit that seems to fail. It seems it fails at #1

Re: Script Fail
Posted: June 29th, 2023, 12:24 pm
by methanoid
safihre wrote: ↑June 29th, 2023, 11:30 am
I think you should just use the Cleanup List in SABnzbd itself 5o remove unwanted extensions.
Then you just need the script for the other stuff.
Also SFV was already in cleanup list but still got thru... wonder if its case sensitive?
Re: Script Fail
Posted: June 29th, 2023, 2:22 pm
by sander
"it fails" does not help much. What is the output of the script?
And: start small, with a working script, maybe just two lines, and from there build up line-by-line
And you can run it from the command line, a bit like:
Code: Select all
./somescript.sh finaldir orgnzbname cleanname 111 tv alt.binaries.text 0 www.example.com
+ echo 0
0
+ '[' 0 = 0 ']'
+ mv finaldir /home/me/SCRATCH/cleanname
mv: cannot stat 'finaldir': No such file or directory
Re: Script Fail
Posted: June 29th, 2023, 2:34 pm
by methanoid
Sorry didnt spot I'd missed output

It fails on 1st action
+ '[' 0 = 0 ']'
+ mv /mnt/downloads/roms/Nintendo_Switch/FILE_NSW-SUXXORS /home/me/SCRATCH/FILE_NSW-SUXXORS
mv: cannot move '/mnt/downloads/roms/Nintendo_Switch/FILE_NSW-SUXXORS' to '/home/me/SCRATCH/FILE_NSW-SUXXORS': No such file or directory
Re: Script Fail
Posted: June 29th, 2023, 2:46 pm
by sander
methanoid wrote: ↑June 29th, 2023, 2:34 pm
Sorry didnt spot I'd missed output

It fails on 1st action
+ '[' 0 = 0 ']'
+ mv /mnt/downloads/roms/Nintendo_Switch/FILE_NSW-SUXXORS /home/me/SCRATCH/FILE_NSW-SUXXORS
mv: cannot move '/mnt/downloads/roms/Nintendo_Switch/FILE_NSW-SUXXORS' to '/home/me/SCRATCH/FILE_NSW-SUXXORS': No such file or directory
Good.
Now try to think: which of those file/dirs do not exist?
What if you run that
mv /mnt/downloads/roms/Nintendo_Switch/FILE_NSW-SUXXORS /home/me/SCRATCH/FILE_NSW-SUXXORS
from the command line? Why doesn't it work? What do you have to change to get it working.
Or: if you google "No such file or directory, mv" what do the first google hits tell you.
Re: Script Fail
Posted: June 30th, 2023, 6:22 am
by methanoid
It was not working for other non SAB reasons. I've found a better way to do it now using categories and a different script and file locations.
Now just need to get SAB to auto apply my "Over50" category to any download over 50GB, using the pre- script...