DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2010-04-28 17:30:37

bound4h
Member
Registered: 2010-04-12
Posts: 209

404:Unauthorized User error

Hello,

I am trying to run two scripts to download torrents automatically.  I am using them from: http://www.horto.ca/?p=10

The first is the torrentwatchdog.sh script which monitors a folder for .torrents and adds them to Transmission and then deletes the .torrent file afterward.  The other is a cron job to run this every hour.  Pretty simple, except I think maybe my permissions are wrong?  But I can't figure out what I'm missing?

Here is the script:

Code:

#!/bin/sh
###########################################################################
# script to monitor a specific directory for new .torrent files.
# if found, queue them up in transmission
# and when done downloading, pause the torrent
# w 10/20/08 horto
# u 10/29/08 horto - implmented "make transmission stop after seeding 1:1"
###########################################################################
TORRENTDIR=/mnt/HD_a2/Torrents/torrents
WDLOG=/mnt/HD_a2/logs/torrentwd.log
TRANSMISSION_REMOTE=/ffp/bin/transmission-remote

# check incoming TORRENTDIR
for FILE in $TORRENTDIR/*.torrent; do
  if [ "$FILE" != "$TORRENTDIR/*.torrent" ]; then
      echo [`date`] "$FILE" added to queue. >> $WDLOG
      $TRANSMISSION_REMOTE -a "$FILE"
      rm "$FILE"
      echo [`date`] "$FILE" deleted from directory. >> $WDLOG
      sleep 1
  fi
done

# stop completed downloads
for i in `/ffp/bin/transmission-remote -l | grep Done | grep -v Ratio | awk '{print $1}'"`; do
  echo [`date`] stopping torrent id $i >> $WDLOG
  $TRANSMISSION_REMOTE -t $i -S
done


exit 0

Here are the permissions for the above referenced folders/programs:

directory /mnt/HD_a2/.transmission-daemon has 755, owner nobody:root
directory /mnt/HD_a2/Torrents has 755, owner nobody:root
directory /mnt/HD_a2/Media has 755, owner nobody:root
directory /mnt/HD_a2/logs has 755, owner nobody:root
file /ffp/bin/.transmission-remote has 755, owner root:root
file /ffp/bin/.transmission-deamon has 755, owner root:root

And the torrentwd.log file says:

Code:

/ffp/var/scripts/torrentwatchdog.sh: Permission denied
[Wed Apr 28 01:25:12 GMT 2010] /mnt/HD_a2/Torrents/torrents/[www.seedpeer.com] Slackware 12 2 Dvd.SEEDPEER.torrent added to queue.
[Wed Apr 28 01:25:14 GMT 2010] /mnt/HD_a2/Torrents/torrents/[www.seedpeer.com] Slackware 12 2 Dvd.SEEDPEER.torrent deleted from directory.
[Wed Apr 28 01:34:13 GMT 2010] /mnt/HD_a2/Torrents/torrents/The_Hurt_Locker_2008_BRRip_H264_5.1_ch_SecretMyth__Kingdom_Release_.torrent added to queue.
[Wed Apr 28 01:34:14 GMT 2010] /mnt/HD_a2/Torrents/torrents/The_Hurt_Locker_2008_BRRip_H264_5.1_ch_SecretMyth__Kingdom_Release_.torrent deleted from directory.
awk: No such file or directory
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
awk: No such file or directory
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
awk: No such file or directory
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
awk: No such file or directory
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
awk: No such file or directory
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
awk: No such file or directory
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
awk: No such file or directory
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
Unexpected response: <h1>401: Unauthorized</h1>Unauthorized User
awk: No such file or directory

I don't have a username/pw set for Transmission (v1.92) as I just login to the web interface with blank username/pw.  Does this mean I have to set one up?  If so, how?  I can't find how to do that in the web interface.

Thanks to anyone who can help

Offline

 

#2 2010-04-29 17:53:53

karlrado
Member
Registered: 2009-12-07
Posts: 229

Re: 404:Unauthorized User error

You do not have awk installed and/or awk is not in the PATH when a cron job runs.

Install awk if it is not installed.

Consider putting the full pathname to the awk executable in your script or set the PATH variable at the top of the script so that it includes the directory containing awk, as well as everything else the script needs.

Debugging tip:  add an echo $PATH statement to your script so you can see what the effective path is.

The second for loop will always fail to set i correctly with awk missing, so calling transmission will always fail too.


DNS-323 FW 1.07 : 2 1TB WD Caviar Green SATA : fun_plug: utelnet + optware (no ffp)

Offline

 

#3 2010-04-29 17:57:20

bound4h
Member
Registered: 2010-04-12
Posts: 209

Re: 404:Unauthorized User error

Turns out the settings.json file had the wrong permissions.  So, what I think was happening was transmission-remote could not run (bc the daemon never started) and since remote didn't run, awk didn't have a "file or directory" to act upon.  (I had to check transmission's log to find the settings.json error)

It's working now, no errors.  Thanks!

Last edited by bound4h (2010-04-29 17:58:05)

Offline

 

#4 2010-05-01 08:57:10

nUll
Member
Registered: 2008-03-09
Posts: 113

Re: 404:Unauthorized User error

bound4h,

What exactly did you do to fix it?

Thanks

Offline

 

#5 2010-05-02 07:47:25

bound4h
Member
Registered: 2010-04-12
Posts: 209

Re: 404:Unauthorized User error

Since the transmission.sh (/ffp/start/transmission.sh) initiates the program under the user 'nobody', it could not read the settings.json file because it had diff permissions denying access.  chown nobody /path/to/settings.json did the trick (or i guess a global read would have worked too).

PS- Check the transmission log file if you're having problems running the program itself (as was the root cause of my issue) aside from any scripts you're trying to run alongside it. (/mnt/HD_a2/.transmission-daemon/transmission-daemon.log)

Last edited by bound4h (2010-05-02 07:50:28)

Offline

 

#6 2010-05-09 06:38:20

nUll
Member
Registered: 2008-03-09
Posts: 113

Re: 404:Unauthorized User error

Still not working and the log file shows nothing out of the ordinary...

Offline

 

#7 2010-10-03 21:32:49

tanstaafl1963
Member
Registered: 2009-08-22
Posts: 58

Re: 404:Unauthorized User error

Hi Kyle,
  last week, it seemed that automatic stopped working for me. I'd been using it for about 12 months or so, using an RSS feeder. 

I've rebooted the NAS and Transmission comes up fine, but automatic doesn't start.  I've also tried to start it manually, and all the log file comes back with is
'Segmentation fault'.

"automatic -f -v 3 -c /ffp/etc/automatic.conf >automatic.log 2>&1"
gives me the Segmentation fault

I've attached my conf file, which as you can see is pretty old since some of the shows are no longer on smile

I've not tweaked anything (other than the showrss userid) before uploading. 

-rwxrwxrwx    1 root     root          620 Mar 29  2010 /ffp/start/automatic.sh

I'm not sure what changed to make it stop loading....

any ideas?

Thanks !


Attachments:
Attachment Icon automatic.conf, Size: 3,024 bytes, Downloads: 241

DNS-323 FW 1.09
2 2-TB Drives
Automatic  0.7.0 |  Transmission 2.42

Offline

 

#8 2010-10-03 22:31:27

sharks
Member
Registered: 2009-06-03
Posts: 13

Re: 404:Unauthorized User error

@tanstaafl1963: no ' " ' after names in patterns; normal?

Offline

 

#9 2010-10-04 14:26:15

bound4h
Member
Registered: 2010-04-12
Posts: 209

Re: 404:Unauthorized User error

Is automatic in your PATH?  Maybe try using the absolute rather than relative path to automatic?

Offline

 

#10 2010-10-11 18:28:52

bound4h
Member
Registered: 2010-04-12
Posts: 209

Re: 404:Unauthorized User error

@tanstaafl1963,

sharks is right, it looks like you left off the " at the right of your patterns (at least the bottom 15 or so).

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB