Page 1 of 1

[SOLVED] Issue launching script after uTorrent dl completes

Posted: Sun Jan 22, 2012 7:04 pm
by techlife
I'm still on F12. I have not been granted access to the beta program so I am not using the Amahi add-on. This isn't an Amahi issue which is why I chose the general discussion area. I have posted in the uTorrent forum but people there aren't very helpful. They are just sending me to the perl sites. It's not a perl issue...my script works. Everyone here is so knowledgeable and helpful that I thought it may be worth a shot. If this is in the wrong area, please move it. If anyone knows where I may better be helped, please tell me. All of that being said, here we go:

All I am trying to do is run a perl script when a download completes in uTorrent. The following is what needs to run:

Code: Select all

/home/user/Desktop/Scripts/myscript.pl
I have tried each of the following in the 'run program' box in uTorrent:

Code: Select all

/home/user/Desktop/Scripts/myscript.pl perl /home/user/Desktop/Scripts/myscript.pl /usr/bin/perl /home/user/Desktop/Scripts/myscript.pl "/usr/bin/perl /home/user/Desktop/Scripts/myscript.pl" /usr/bin/perl "/home/user/Desktop/Scripts/myscript.pl"
The script itself works fine. I can type either of these at the command line:

Code: Select all

perl /home/user/Desktop/Scripts/myscript.pl /usr/bin/perl /home/user/Desktop/Scripts/myscript.pl
It launches and does exactly what it's supposed to.

Launching uTorrent from the command line to monitor the output, it looks like the script is being launched:

Code: Select all

Executing: /usr/bin/perl /home/user/Desktop/Scripts/myscript.pl
But it doesn't actually run. The script outputs to a log file and there is nothing there after it's supposedly executed from uTorrent. Maybe it isn't uTorrent itself. Maybe a permissions issue? If uTorrent is launched as root, would the perl script be launched that way also? Though if I run the script without elevated privileges, it still works fine so I'm not sure why it would matter.

If anyone can help, it would be greatly appreciated as I am at wits end here. Thanks in advance!

Re: Issue launching perl script after uTorrent dl completes

Posted: Mon Jan 23, 2012 8:42 pm
by radioz
What happens when you run your script as root?

i.e: sudo perl /home/user/Desktop/Scripts/myscript.pl

Does that work?

Re: Issue launching perl script after uTorrent dl completes

Posted: Mon Jan 23, 2012 10:33 pm
by techlife
Yes, it works fine wether root or main user. I tried changing the permissions on the Scripts folder and contents to 777 today and that made no difference either...

[ Post made via iPad ] Image

Re: Issue launching perl script after uTorrent dl completes

Posted: Mon Jan 23, 2012 11:25 pm
by radioz
I'm not familiar with uTorrent, but often apps like that run with permissions of a different user and/or group id.

If uTorrent were running as a different user, that could explain the problem you are having. That user might not have the permissions you do and so the script would fail.

Try to find out what user and group it runs as. You may need to add that user (whatever that might be) to the 'users' group. Apache is done that way. If you look at /etc/group you'll find an entry for 'users' with you and apache as members.

Re: Issue launching perl script after uTorrent dl completes

Posted: Tue Jan 24, 2012 1:37 pm
by techlife
It makes perfect sense and I was really hoping you were right but if I'm reading this correctly, it is running as a normal user:

Code: Select all

$ ps aux | grep utserver user 20956 0.3 0.1 59852 8136 ? Sl Jan23 3:32 utserver -settingspath /opt/utorrent-server-v3_0/
P.S. My user name isn't really 'user'. In all posts, I replace my actual user name with 'user' changing nothing else.

Re: Issue launching perl script after uTorrent dl completes

Posted: Tue Jan 24, 2012 7:47 pm
by techlife
I got it going... Thanks very much for the response and a point in the right direction!!

In case you're interested, this is how it all played out: http://forums.fedoraforum.org/showthread.php?t=275599

Re: [SOLVED] Issue launching script after uTorrent dl comple

Posted: Wed Jan 25, 2012 8:28 pm
by radioz
Hey, glad you got it going! That was a good learning experience.