aMule Forum

English => aMule Help => Topic started by: Syphon on July 03, 2010, 12:15:07 PM

Title: Downloaded File Event.. Shell Script don't want to run!
Post by: Syphon on July 03, 2010, 12:15:07 PM
Hi Guys!
I've a got a problem about downloaded file permissions. I use amule daemon so I have to configure the amule.conf. I found i can set amule to auto run a command or a shell script after the "download completed event" by enabling "CoreEnabled".

So I Wrote:

Code: [Select]
CoreEnabled = 1
CoreCommand = permissions.sh "%FILE"

The script is:
Code: [Select]
#!/bin/bash

chmod 770 $1
chown user:group $1

$1 should refers to "%FILE" arg,but it doesn't work!
Logfile says is impossible to run "permission.sh".

Where's the mistake?

Any help would be very appreciated..


P.s. permission.sh is in the same directory of amule.conf. and it's chmodded 777.
P.p.s. Everything works ok if I write just a single command in the "CoreCommand" section,i.e. chmod 770 "%FILE".
Title: Re: Downloaded File Event.. Shell Script don't want to run!
Post by: GonoszTopi on July 03, 2010, 06:51:08 PM
Logfile says is impossible to run "permission.sh".

Where's the mistake?

The command (script, in your case) must be accessible via the PATH setting of the amule(d) process, or it should contain the full (absolute) pathname to run.

So, in your case you'd probably want to write something like
Code: [Select]
CoreCommand = /home/amuled_user/.aMule/permissions.sh "%FILE"

Please note, that amuled does not chdir() to the directory containing amule.conf (in which case you should have written ./permissions.sh), nor does it any black magic to find out where your executable lies. That's left to the operating system.
Title: Re: Downloaded File Event.. Shell Script don't want to run!
Post by: Syphon on July 06, 2010, 05:22:45 PM
Thank You for The Answer!
 
I modified the amule.conf:
Code: [Select]
CoreCommand: sh -c '/home/amuled_user/.aMule/permissions.sh "%FILE"'

I modified the shell script, otherwise it doesn't work with filename with spaces.

Code: [Select]
#!/bin/bash

chmod 755 "$1"
chown user:group "$1"

Now it's perfect!

Thank you so much for your support!

Best regards

Syphon