Par2 not found when using Sudo command

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
tmiski
Newbie
Newbie
Posts: 10
Joined: September 22nd, 2011, 1:58 pm

Par2 not found when using Sudo command

Post by tmiski »

I've install sabnzbd+, unrar, and par2 using the optware pkg installer on my WD My Book Live. It all works great as long as I run sabnzbd as root. I tried using sudo to run sabnzb+ under the account usenet (that I created). But sab can't find the Par2 files. I checked my path and permissions and I don't see any issues.

This is how I start and stop sabnzbd+

Code: Select all

#!/bin/sh
NAME="/etc/init.d/sabnzbd"
case "$1" in
start)
  echo "Starting SABnzbd."
  sudo -u usenet /opt/bin/python2.5 /opt/share/SABnzbd/SABnzbd.py -f /opt/share/SABnzbd/sabnzbd.ini -d
;;
stop)
  echo "Shutting down SABnzbd. "
  /usr/bin/wget -q "http://0.0.0.0:8080/sabnzbd/api?mode=shutdown&apikey=KEY_REMOVED"
;;
restart)
    "$NAME" stop
    "$NAME" start
;;
*)
  echo "Usage: $0 {start|stop|restart}"
  exit 1
esac
exit 0

When I su to the usenet account I can find and run par2 just fine. Not sure what the problem is. The par files are not writeable but that should be ok.

Code: Select all

MyBookLive# su usenet

usenet@MyBookLive# echo $PATH
/opt/bin:/opt/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

usenet@MyBookLive# which par2
/opt/bin/par2

usenet@MyBookLive# ls -la /opt/bin/par*
-rwxr-xr-x 1 root root 219068 Nov 30  2010 /opt/bin/par2
lrwxrwxrwx 1 root root      4 Oct  2 11:35 /opt/bin/par2create -> par2
lrwxrwxrwx 1 root root      4 Oct  2 11:35 /opt/bin/par2repair -> par2
lrwxrwxrwx 1 root root      4 Oct  2 11:35 /opt/bin/par2verify -> par2

usenet@MyBookLive# ls -la /opt/lib/libpar*
lrwxrwxrwx 1 root root     16 Oct  2 11:30 /opt/lib/libpar2.so -> libpar2.so.0.0.1
lrwxrwxrwx 1 root root     16 Oct  2 11:30 /opt/lib/libpar2.so.0 -> libpar2.so.0.0.1
-rwxr-xr-x 1 root root 293328 Nov 30  2010 /opt/lib/libpar2.so.0.0.1
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Par2 not found when using Sudo command

Post by sander »

So ... what is the problem related to SABnzbd?
tmiski
Newbie
Newbie
Posts: 10
Joined: September 22nd, 2011, 1:58 pm

Re: Par2 not found when using Sudo command

Post by tmiski »

When the download is complete it fails. I believe it's related to not being able to find par2. That's the only difference that I've found so far.
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Par2 not found when using Sudo command

Post by jcfp »

tmiski wrote:usenet@MyBookLive# echo $PATH
/opt/bin:/opt/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

usenet@MyBookLive# which par2
/opt/bin/par2
You are blindly assuming the same PATH (with all that /opt and /usr/local stuff) gets set when running init scripts, which is highly unlikely.
tmiski
Newbie
Newbie
Posts: 10
Joined: September 22nd, 2011, 1:58 pm

Re: Par2 not found when using Sudo command

Post by tmiski »

You're right about that. I was hoping someone could show me the light on how/where to set the path.
Post Reply