Start aria2 at boot?

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

Start aria2 at boot?

Postby jerry0000 » Tue Dec 25, 2012 5:08 am

I installed aria2, and the web client (http://sourceforge.net/apps/phpbb/aria2 ... ?f=1&t=195) under the httpd server on the pogo. Everything works fine, however I am having trouble to start aria2 at boot.

Looks like rc.local is no longer used, as ALARM uses systemd now??? /etc/rc.local is empty on my installation. I added this line:

$this->bbcode_second_pass_code('', 'su aria2 -c "aria2c --conf-path=/etc/aria2.conf --enable-rpc --rpc-listen-all --daemon"')

to start aria2c using unprivileged user "aria2" as a daemon and listen to web client. This command works fine on command line. However reboot did not start aria2. Looks like /etc/rc.local is being ignored.

So what is the best place to start aria2 at boot? aria2 itself does not support systemd.

BTW, any other all-in-one (BT, HTTP, etc) download mangers for ALARM?
Last edited by jerry0000 on Wed Dec 26, 2012 6:40 am, edited 1 time in total.
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am

Re: Start aria2 at boot?

Postby moonman » Tue Dec 25, 2012 7:59 am

Create the service yourself:
$this->bbcode_second_pass_code('', 'nano /etc/systemd/system/aria.service')

then paste this:
$this->bbcode_second_pass_code('', '[Unit]
Description=aria daemon
After=network.target

[Service]
User=root
Type=oneshot
ExecStart=aria2 -c "aria2c --conf-path=/etc/aria2.conf --enable-rpc --rpc-listen-all --daemon"
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target')

thendo

systemctl start aria.service

and see if it starts.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Re: Start aria2 at boot?

Postby jerry0000 » Wed Dec 26, 2012 12:43 am

Tried:
$this->bbcode_second_pass_code('', 'Failed to issue method call: Unit aria2c.service failed to load: Invalid argument. See system logs and 'systemctl status aria2c.service' for details.')

systemctl status aria2c.service gives:
$this->bbcode_second_pass_code('', 'aria2c.service - aria daemon
Loaded: error (Reason: Invalid argument)
Active: failed (Result: exit-code) since Tue, 2012-12-25 16:59:02 PST; 1min 58s ago
Main PID: 2576 (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/aria2c.service

Dec 25 16:59:02 pogoplug aria2c[2681]: starts with "#". For example, type "--help=#http"
Dec 25 16:59:02 pogoplug aria2c[2681]: to get the usage for the options tagged with
Dec 25 16:59:02 pogoplug aria2c[2681]: "#http". If non-tag word is given, print the usage
Dec 25 16:59:02 pogoplug aria2c[2681]: for the options whose name includes that word.
Dec 25 16:59:02 pogoplug aria2c[2681]: Possible Values: #basic, #advanced, #http, #https, #ftp, #metalink, #bittorren..., #all
Dec 25 16:59:02 pogoplug aria2c[2681]: Default: #basic
Dec 25 16:59:02 pogoplug aria2c[2681]: Tags: #basic, #help
Dec 25 16:59:02 pogoplug aria2c[2681]: Refer to man page for more information.
Dec 25 16:59:02 pogoplug systemd[1]: Failed to start aria2 Service.
Dec 25 16:59:02 pogoplug systemd[1]: Unit aria2c.service entered failed state
')
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am

Re: Start aria2 at boot?

Postby jerry0000 » Wed Dec 26, 2012 1:05 am

found this:

https://github.com/GutenYe/systemd-unit ... ster/aria2

Unfortunately, this one does not work either:

systemctl status aria2c
$this->bbcode_second_pass_code('', 'aria2c.service - aria2 Service
Loaded: loaded (/usr/lib/systemd/system/aria2c.service; disabled)
Active: failed (Result: exit-code) since Tue, 2012-12-25 17:11:37 PST; 13s ago
Process: 391 ExecStart=/etc/systemd/scripts/aria2-start (code=exited, status=0/SUCCESS)
Main PID: 393 (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/aria2c.service

Dec 25 17:11:37 pogoplug systemd[1]: Started aria2 Service.
Dec 25 17:11:37 pogoplug systemd[1]: aria2c.service: main process exited, code=exited, status=1/FAILURE
Dec 25 17:11:37 pogoplug systemd[1]: Unit aria2c.service entered failed state
')
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am

Re: Start aria2 at boot?

Postby jerry0000 » Wed Dec 26, 2012 1:19 am

I had to change the User=root to make this work.

$this->bbcode_second_pass_code('', 'User=root')

in the service script:

$this->bbcode_second_pass_code('', '[Unit]
Description=aria2 Service
After=network.target

[Service]
Type=forking
User=%i
WorkingDirectory=/home/%i
Environment=VAR=/var/%i
ExecStart=/etc/systemd/scripts/aria2-start

[Install]
WantedBy=multi-user.target')

How can I set the service to run as an unprivileged user aria2????
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am

Re: Start aria2 at boot?

Postby WarheadsSE » Wed Dec 26, 2012 2:48 am

That would expect it to be
$this->bbcode_second_pass_code('', '
systemctl enable aria2@user
')
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Start aria2 at boot?

Postby jerry0000 » Wed Dec 26, 2012 4:11 am

$this->bbcode_second_pass_quote('WarheadsSE', 'T')hat would expect it to be
$this->bbcode_second_pass_code('', '
systemctl enable aria2@user
')


thanks. however it did not work:
$this->bbcode_second_pass_code('', 'Failed to issue method call: No such file or directory')

I am wondering what the "User=" does in the daemon script? Is no it suppose to specify running user?
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am

Re: Start aria2 at boot?

Postby jerry0000 » Wed Dec 26, 2012 4:51 am

I modified the daemon script on:
$this->bbcode_second_pass_code('', 'https://github.com/GutenYe/systemd-units/tree/master/aria2')

to:
$this->bbcode_second_pass_code('', '[Unit]
[Unit]
Description=aria2 Service
After=network.target

[Service]
Type=forking
User=root
WorkingDirectory=/media/data/aria2
Environment=/var/aria2
ExecStart=/usr/bin/aria2c --conf-path=/etc/conf.d/aria2

[Install]
WantedBy=multi-user.target
')

and eliminated the startup script (as it only invokes one command, so I just put into the deamon itself). Also simplified ExecStart command by putting all options in the conf file:

$this->bbcode_second_pass_code('', '
daemon=true
enable-rpc=true
rpc-listen-all=true
dir=/media/data/aria2
save-session=/var/aria2/aria2.session
input-file=/var/aria2/aria2.session
log=/var/aria2/aria2.log
log-level=warn
continue=true
max-connection-per-server=5
max-concurrent-downloads=10
min-split-size=5M
')

It seems to work,however I still have the "root" user issue. I do not want to run as "root". However if I change the "User=" to any user other than root, the deamon will not start.

Please help.
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am

Re: Start aria2 at boot?

Postby jerry0000 » Wed Dec 26, 2012 6:40 am

BTW, I could not make this:

$this->bbcode_second_pass_code('', 'su aria2 -c "aria2c --conf-path=/etc/aria2.conf --enable-rpc --rpc-listen-all --daemon"')

work from command line any more. Not sure why. It never worked inside a script any way.

I am wondering if I can just simply try crontab.
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am

Re: Start aria2 at boot?

Postby jerry0000 » Sun Dec 30, 2012 5:54 am

It turns out the reason I was having trouble to run aria2c as an unprivileged user (as well as the sudo command line not working) is that I did not have the proper ownership for the log directory. After chown to aria2:aria2, everything works now.
jerry0000
 
Posts: 57
Joined: Tue Dec 11, 2012 5:38 am


Return to Marvell Kirkwood

Who is online

Users browsing this forum: Google [Bot] and 29 guests