Script Fail

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
methanoid
Jr. Member
Jr. Member
Posts: 66
Joined: March 7th, 2008, 6:33 am

Script Fail

Post 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
User avatar
safihre
Administrator
Administrator
Posts: 5366
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Script Fail

Post 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.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
methanoid
Jr. Member
Jr. Member
Posts: 66
Joined: March 7th, 2008, 6:33 am

Re: Script Fail

Post by methanoid »

Thanks, thats handy but that's not the bit that seems to fail. It seems it fails at #1 😔
methanoid
Jr. Member
Jr. Member
Posts: 66
Joined: March 7th, 2008, 6:33 am

Re: Script Fail

Post 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?
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Script Fail

Post 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
methanoid
Jr. Member
Jr. Member
Posts: 66
Joined: March 7th, 2008, 6:33 am

Re: Script Fail

Post 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
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Script Fail

Post 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.
methanoid
Jr. Member
Jr. Member
Posts: 66
Joined: March 7th, 2008, 6:33 am

Re: Script Fail

Post 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...
Post Reply