[Solved] Auto unpack not working

dsouvik215

Member
May 25, 2018
896
0
16
I can't the the auto unpack feature in the unpack plug-in to work. After a download finish nothing happens.
I've ticked off the autounpack and choose a dir for it to unpack to....

right click and choosing unpack on a torrent works fine. What to do huh.gif

I've made a clean install using the autodl-setup script on a ubuntu 10.10 server.
I'm a bit new to Rutorrent so maybe I've missed something in a .conf somewhere
 

das329717

Member
May 25, 2018
928
0
16
check to see if you have any errors in your webserver logs.

Also, do you have the command line php setup properly in your rutorrent config.php for the user?
 

jith45

Member
May 25, 2018
960
0
16
where would I find those logs?

and what command line php? in which config.php?

could you please point me in the right direction as I haven't changed anything in any config files.
 

somus1735

Member
May 25, 2018
833
0
16
didn't you set up rutorrent?

do you have command line php installed on your server?

check the output of:
Code:
php -v

and put the putput of
Code:
which php

in your rutorrent config.php

whatever directory you installed rutorrent to, look in conf/config.php

or if you are using multiple users, it may be conf/users/USERNAME/config.php
 

shwetha17

Member
May 24, 2018
785
0
16
I can verify that it's not working for me either.

To fix it, edit your rutorrent/plugins/unpack/unpack.php (in your case it's: /var/rutorrent/rutorrent/plugins/unpack/unpack.php ) and go to line 103. Original code:

Code: [Select]
103 exec( 'sh -c '.escapeshellarg($rootPath.'/plugins/unpack/un'.$mode.$postfix.'.sh')." ".
104 escapeshellarg($arh)." ".
105 escapeshellarg($basename)." ".
106 escapeshellarg($outPath)." ".
107 "/dev/null ".
108 "/dev/null ".
109 escapeshellarg($pathToUnzip)." &" );

Remove -c from line 103. New code (only line 103 is modified):

Code:
103 exec( 'sh '.escapeshellarg($rootPath.'/plugins/unpack/un'.$mode.$postfix.'.sh')." ".
104 escapeshellarg($arh)." ".
105 escapeshellarg($basename)." ".
106 escapeshellarg($outPath)." ".
107 "/dev/null ".
108 "/dev/null ".
109 escapeshellarg($pathToUnzip)." &" );

Here's the original code when ruTorrent 3.2 was released. There's no '-c' flag at all.

Code:
104 exec( 'sh '.escapeshellarg($rootPath.'/plugins/unpack/un'.$mode.$postfix.'.sh')." ".
105 escapeshellarg($arh)." ".
106 escapeshellarg($basename)." ".
107 escapeshellarg($outPath)." ".
108 "/dev/null ".
109 "/dev/null ".
110 escapeshellarg($pathToUnzip) );

It appears to be a bug in the unpack plugin.
 

dsouvik215

Member
May 25, 2018
896
0
16
Thanks Brock - That was exactly the solution I was looking for.
Not only did it solve the problem but it was also explained so everyone could understand it.

Great work \^_^/
 

dsouvik215

Member
May 25, 2018
896
0
16
Very strange. I think, in the new variant

Quote
Code
103 exec( 'sh -c '.escapeshellarg($rootPath.'/plugins/unpack/un'.$mode.$postfix.'.sh')." ".
104 escapeshellarg($arh)." ".
105 escapeshellarg($basename)." ".
106 escapeshellarg($outPath)." ".
107 "/dev/null ".
108 "/dev/null ".
109 escapeshellarg($pathToUnzip)." &" );​


and in the original 3.2 code script will start with "attached" state. E.q. rtorrent will not work during unpack. Is you test this? If yes - i will change code to your variant.
 

jith45

Member
May 25, 2018
960
0
16
This code seemed to run the job in the background. I added a " after -c and a \" after & :

Code: [Select]
103 exec( 'sh -c "'.escapeshellarg($rootPath.'/plugins/unpack/un'.$mode.$postfix.'.sh')." ".
104 escapeshellarg($arh)." ".
105 escapeshellarg($basename)." ".
106 escapeshellarg($outPath)." ".
107 "/dev/null ".
108 "/dev/null ".
109 escapeshellarg($pathToUnzip)." & \"" );

The -c is needed or you'll get an error.

The other "solution" I gave above seemed to hang rtorrent until the unpack was finished, though.

I added a sleep 30 at the end of the un*_*.sh files and rtorrent accepted user input (i.e., not blocking).
 

shwetha17

Member
May 24, 2018
785
0
16
This code seemed to run the job in the background. I added a " after -c and a \" after & :

Code: [Select]
103 exec( 'sh -c "'.escapeshellarg($rootPath.'/plugins/unpack/un'.$mode.$postfix.'.sh')." ".
104 escapeshellarg($arh)." ".
105 escapeshellarg($basename)." ".
106 escapeshellarg($outPath)." ".
107 "/dev/null ".
108 "/dev/null ".
109 escapeshellarg($pathToUnzip)." & \"" );

The -c is needed or you'll get an error.

The other "solution" I gave above seemed to hang rtorrent until the unpack was finished, though.

I added a sleep 30 at the end of the un*_*.sh files and rtorrent accepted user input (i.e., not blocking).
OK added the changes to unpack.php but in which files should I add the sleep 30 ?
 

das329717

Member
May 25, 2018
928
0
16
OK added the changes to unpack.php but in which files should I add the sleep 30 ?
Don't add sleep at all. It was just a test to make sure rtorrent wasn't blocking. You should do this as root:

Code:
cd /var/rutorrent/rutorrent/plugins/unpack && svn revert unpack.php && svn up && echo OK || echo FAILED
 

jith45

Member
May 25, 2018
960
0
16
Ok I did the svn thingy as root and it worked. Unpacking is now working but rtorrent hangs when autounpack is running. The rutorrent log comes up with a timeout. When unpacking is finished everything is back to normal.

Should it do this?
 

somus1735

Member
May 25, 2018
833
0
16
Ok I did the svn thingy as root and it worked. Unpacking is now working but rtorrent hangs when autounpack is running. The rutorrent log comes up with a timeout. When unpacking is finished everything is back to normal.

Should it do this?
No. Are you sure you're using the latest version? Check the file manually.
 

dsouvik215

Member
May 25, 2018
896
0
16
Make sure the file looks like this:

Code:
103 exec( 'sh -c "'.escapeshellarg($rootPath.'/plugins/unpack/un'.$mode.$postfix.'.sh')." ".
104 escapeshellarg($arh)." ".
105 escapeshellarg($basename)." ".
106 escapeshellarg($outPath)." ".
107 "/dev/null ".
108 "/dev/null ".
109 escapeshellarg($pathToUnzip).' " > /dev/null 2>&1 &' );

The changes I made now redirects stdout/stderr or php will hang until the command has finished... I must've missed that somehow.