half_cookies
half_cookies

Reputation: 31

on-download-complete can't work with aria2

i am not root user,so i install aria2-1.34.0 with ./configure --prefix=/home/xxx/.local, everything works fine but on-download-complete

i set on-download-complete=/home/xxx/aria2/a.sh

#!/bin/bash
echo 123 > 1.txt

when a task download completed, the log shows everything is ok

2019-10-28 19:04:11.295587 [NOTICE] [RequestGroup.cc:1216] Download complete: /home/xxx/aria2/data/0.png
2019-10-28 19:04:11.295598 [INFO] [DefaultBtProgressInfoFile.cc:415] The segment file /home/xxx/aria2/data/0.png.aria2 does not exist.
2019-10-28 19:04:11.295612 [INFO] [util.cc:2239] Executing user command: /home/xxx/aria2/a.sh b031d9399fb9d93f 1 /home/xxx/aria2/data/0.png

but actually nothing happened, it didn't work!!!

aria2c path:

/home/xxx/.local/aria2c

aria2.conf

enable-rpc=true

rpc-allow-origin-all=true

rpc-listen-all=false

max-concurrent-downloads=1

continue=true

max-connection-per-server=5

min-split-size=5M

split=5

max-overall-download-limit=5M

max-download-limit=2M

max-overall-upload-limit=0

max-upload-limit=0

dir=/home/xxx/aria2/data

file-allocation=prealloc

on-download-complete=/home/xxx/aria2/a.sh

log=/home/xxx/aria2/aria2.log

log-level=info

i don't know how to deal with it, could u give me any suggestions, thanks.

Upvotes: 2

Views: 2657

Answers (2)

IvanaGyro
IvanaGyro

Reputation: 642

Accroding to the official document

-D, --daemon [true|false]

Run as daemon. The current working directory will be changed to / and standard input, standard output and standard error will be redirected to /dev/null. Default: false

You should modify /home/xxx/aria2/a.sh to

#!/bin/bash
echo 123 > $(dirname $0)/1.txt

to write the output to the right place.

Upvotes: 1

half_cookies
half_cookies

Reputation: 31

got a solution for me

put --on-download-complete in cmd instead of aria2.conf

just run aria2 like:

aria2c --conf-path=/xxx/xxx/arai2.conf --on-download-complete=/xxx/xxx/xxx.sh -D

and it works

but i have no idea why it didn't work if set --on-download-complete in conf file

Upvotes: 1

Related Questions