Post Processing Error

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
auskento
Moderator
Moderator
Posts: 77
Joined: January 21st, 2008, 8:45 pm
Location: Melbourne, AUS

Post Processing Error

Post by auskento »

I have just built a new server up, im now running a 7.10 64 bit Ubuntu system and am having some problems with my post processing script.

All error logging that I have enabled is not actually showing any problem.

In my script, i have an option to chmod and chown the destination folder.
This is completing correctly - ie errorlevel 0 but the folder and file ownership is not being changed.

Its very frustrating as without the rx permission on files / folders, my TVIX box is unable to descend the folder structure and reboots :(

If i run the script manually, everything is ok.

SAB is running as root, I cant figure it out.  any ideas?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Post Processing Error

Post by shypike »

Which SABnzbd version are you using?
Does the logging show anything at all (normally the start of the script is logged) ?
Make sure your logging is at debug level.
The history shows a link to a the output of the script, you could add additional logging to your own script.
auskento
Moderator
Moderator
Posts: 77
Joined: January 21st, 2008, 8:45 pm
Location: Melbourne, AUS

Re: Post Processing Error

Post by auskento »

Im using 0.3.4 at present.

I do log/output a fair amount of info from the script, and in testing, used set -x and verbose on the two commands, both reporting completion.

How do i set debug level logging?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Post Processing Error

Post by shypike »

Use the  command line parameter:

Code: Select all

--logging 2
auskento
Moderator
Moderator
Posts: 77
Joined: January 21st, 2008, 8:45 pm
Location: Melbourne, AUS

Re: Post Processing Error

Post by auskento »

Looks like it was a PEBKAC error :/

In making some changes to the way folders were being made, I used a malformed mkdir command

I was using mkdir --mode=$FILEACCESS -p $DESTFOLDER

the --mode= part was wrong, so it was creating it as 0 :(

I have changed it to mkdir -m $FILEACCESS -p $DESTFOLDER

and all appears to be functioning as intended.
auskento
Moderator
Moderator
Posts: 77
Joined: January 21st, 2008, 8:45 pm
Location: Melbourne, AUS

Re: Post Processing Error

Post by auskento »

Okay, so i spoke a bit too soon :(

I have run my post processing script from CLI as root, and it completes successfully.

When called from SAB 0.3.4 directories are not being created with the access permissions they should have, and the chmod / chown commands, while reporting as completing successfully, are not.

This behaviour has only occurred on new server.  I am running Ubuntu 8.04 64 bit (upgraded from 7.10) in the last few days.

Both 7.10 and 8.04 have exhibited this problem.

All I can think to do now is have the script create some sort of 'cron' trigger to do the ownership and permissions changes.  (Though i have to figure out how to do that too :) )
auskento
Moderator
Moderator
Posts: 77
Joined: January 21st, 2008, 8:45 pm
Location: Melbourne, AUS

Re: Post Processing Error

Post by auskento »

Some log information.

Here is the output of a recently completed job.

Code: Select all

Hello,

SABnzbd has downloaded '<showname>'.

Finished at 2008-04-29 14:21:04
Downloaded 366.3 MB

Results of the job:

Stage Par2
    [DEL-INFO] <showname> => Deleted 2 file(s)
    [PAR-INFO] <showname> => Verified in 6.1s, all files correct Stage Unrar
    [RAR-INFO] <showname> => Unpacked 1 file(s) in 5.2s
    [DEL-INFO] <showname> => Deleted 25 file(s)

External processing:

----- Started Processing: 29 Apr 2008  14:20:57 ----- Folder Path: /ntfs250/usenet/TV/<showname>Getting category from folder name
Category: TV
Content is AVI
Content is a single episode
Show Name: <showname>
Season Number: 6
+ mkdir -p '/ntfs250/TV/#Incoming/<showname>/Season 6'
+ '[' 0 -ne 0 ']'
+ log 'Destination folder /ntfs250/TV/#Incoming/<showname>/Season 6 created.  Processing <showname>
+ '[' ON = ON ']'
+ echo 'Destination folder /ntfs250/TV/#Incoming/<showname>/Season 6 created.  Processing <showname>
+ echo 'Destination folder /ntfs250/TV/#Incoming/<showname>/Season 6 created.  Processing <showname>
Destination folder /ntfs250/TV/#Incoming/<showname>/Season 6 created.  Processing <showname>
+ set +x
+ '[' =YES '!=' NO ']'
+ log 'Setting /ntfs250/TV/#Incoming/<showname>/Season 6 ownership to root:www-data and access to 655'
+ '[' ON = ON ']'
+ echo 'Setting /ntfs250/TV/#Incoming/<showname>/Season 6 ownership to root:www-data and access to 655'
+ echo 'Setting /ntfs250/TV/#Incoming/<showname>/Season 6 ownership to root:www-data and access to 655'
Setting /ntfs250/TV/#Incoming/<showname>/Season 6 ownership to root:www-data and access to 655
+ chown -R root:www-data '/ntfs250/TV/#Incoming/<showname>/Season 6'
+ '[' 0 '!=' 0 ']'
+ chmod -R +rx '/ntfs250/TV/#Incoming/<showname>/Season 6'
+ '[' 0 '!=' 0 ']'
+ set +x
<showname> processed correctly Removing Folder: <showname>...
Done!


Enjoy!
Here is the result of a ls on the parent folder

Code: Select all

drwx------  3 root root     4.0K 2008-04-29 14:20 <showname>/
If I run this script manually, it processes everything fine.  Folders and files are created with correct permissions, its only through SAB that the problem is occurring.

This is the current running task for SAB

Code: Select all

root      6051  1.2  1.6 332584 26188 ?        Sl   14:05   0:25 /usr/bin/python -OO /SABnzbd/SABnzbd.py -d -f /SABnzbd/sabnzbd.ini
This is my ini file

Code: Select all

__version__ = 18
[misc]
log_dir = logs
auto_browser = 0
check_new_rel = 1
fail_on_crc = 0
create_group_folders = 0
enable_filejoin = 1
enable_unzip = 1
enable_unrar = 1
enable_save = 1
auto_disconnect = 1
enable_par_cleanup = 1
config_lock = 0
safe_postproc = 0
cleanup_list = ,
send_group = 0
download_dir = downloads/incomplete
download_free = 0
complete_dir = /ntfs250/usenet
nzb_backup_dir = ""
cache_dir = cache
dirscan_dir = ""
dirscan_speed = 5
refresh_rate = 0
rss_rate = 1
extern_proc = /SABnzbd/postproc.sh
bandwith_limit = 0.05
cache_limit = 0
email_server = 192.168.0.2
email_to = xxxxxxxx
email_from = xxxxxxxx
email_account = ""
email_pwd = ""
email_endjob = 1
email_full = 1
schedlines = ,
dirscan_opts = 6
top_only = 1
auto_sort = 0
host = 0.0.0.0
port = 8080
web_dir = smpl
username = ""
password = ""
permissions = 655
[logging]
enable_cherrypy_logging = 1
log_level = 2
max_log_size = 5M
log_backups = 5
[newzbin]
username = xxxxxxxx
password = xxxxxxxx
create_category_folders = 1
[servers]
[[localhost:1191]]
host = localhost
port = 1191
username = xxxxxxxx
password = xxxxxxxx
timeout = 30
connections = 10
fillserver = 0
Last edited by Anonymous on November 26th, 2008, 9:19 pm, edited 1 time in total.
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Post Processing Error

Post by jcfp »

auskento wrote:Here is the result of a ls on the parent folder

Code: Select all

drwx------  3 root root     4.0K 2008-04-29 14:20 <showname>/
And the point of showing this ls output is...? Your script only runs chown/chmod on '/Season 6', and does not touch the parent directory at all, other than (possibly) creating it as part of the mkdir -p command. For root, 0700 and root:root ownership seem sensible default permissions.
Last edited by Anonymous on November 26th, 2008, 9:20 pm, edited 1 time in total.
auskento
Moderator
Moderator
Posts: 77
Joined: January 21st, 2008, 8:45 pm
Location: Melbourne, AUS

Re: Post Processing Error

Post by auskento »

The mkdir -m  command should make the folder with the permissions set, in this case 655, but it didnt.

As you pointed out, and after looking at the resultant subfolder, the chmod / chown were executing ok, but the parent directory wasnt being changed.

I have changed my script to do the whole incoming folder per category.

ie it will do /home/TV/Incoming

not just home/TV/Incoming//Season 6

in my case, I move anything out of the Incoming folder once i have watched it, so the Incoming folder should never get too cluttered.  Either way, it shouldnt take too long to execute the permission changes on bigger storage folders.
Last edited by Anonymous on November 26th, 2008, 9:20 pm, edited 1 time in total.
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Post Processing Error

Post by jcfp »

auskento wrote:The mkdir -m  command should make the folder with the permissions set, in this case 655, but it didnt.
The -m option of mkdir only applies to the "final" directory, but not to any parent even when created at the same time. Default permissions are controlled by umask. Inserting umask 122 at the beginning of your script would cause mkdir to set the permissions to 0655, for any directory created. After that, all that remains is changing group ownership to your liking. Do note that umask might also affect other files created by your script, if any.
auskento
Moderator
Moderator
Posts: 77
Joined: January 21st, 2008, 8:45 pm
Location: Melbourne, AUS

Re: Post Processing Error

Post by auskento »

I did try using umask, but i used umask 0655 :)

Will have to read up a bit more on umask usage.

As it is, I have the ownership processing correctly now its tagging the whole incoming folder each time.

Thanks for your input, it has explained a few things.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Post Processing Error

Post by shypike »

I use 0755, works fine.
It's explained in: http://sabnzbd.wikidot.com/unix-permissions
Post Reply