It seems that i am failing big time to make aria2 autostart on boot.
Config:
- Raspberry Pi 2
- OSMC
- Aria v 1.18.8 (latest apt-get)
Tried to make aria2 autostart via 3 methods:
- init.d
- systemd
- crontab
Also tried the guidance here: https://bbs.archlinux.org/viewtopic.php?id=194644
All above work ok. Note that i can start aria using either the init.d script or by using systemctl start.
My /var/log/aria2.log after startup:
2015-10-20 16:48:29.134906 [ERROR] [HttpListenCommand.cc:114] IPv4 RPC: failed to bind TCP port 10101
Exception: [SocketCore.cc:292] errorCode=1 Failed to bind a socket, cause: Name or service not known
2015-10-20 16:48:29.136017 [ERROR] [HttpListenCommand.cc:114] IPv6 RPC: failed to bind TCP port 10101
Exception: [SocketCore.cc:292] errorCode=1 Failed to bind a socket, cause: Name or service not known
2015-10-20 16:48:29.136283 [ERROR] [MultiUrlRequestInfo.cc:292] Exception caught
Exception: [DownloadEngineFactory.cc:215] errorCode=1 Failed to setup RPC server.
My aria2.conf
daemon=true
enable-rpc=true
rpc-listen-port=10101
rpc-listen-all=true
rpc-secret=losadara6
####### your download folder, ensure that this folder exist! ##########
dir=/mnt/xontros/test/_dl/aria
log=/var/log/aria2.log
log-level=warn
dht-listen-port=53102
auto-save-interval=30
#seed ratio and seed time in minutes
seed-ratio=1.0
seed-time=1460
max-upload-limit=1K
max-download-limit=800K
event-poll=select
pause-metadata=true
My init.d script which runs ok by hand but not when in rc.d
#! /bin/sh
# /etc/init.d/aria2cRPC
### BEGIN INIT INFO
# Provides: aria2cRPC
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: aria2c RPC init script.
# Description: Starts and stops aria2 RPC services.
### END INIT INFO
#VAR
RUN="/usr/bin/aria2c"
ARIA_PID=$(pidof aria2c)
# Some things that run always
touch /var/lock/aria2cRPC
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script aria2cRPC "
if [ -z "$ARIA_PID" ]; then
nohup $RUN --daemon=true --enable-rpc=true -D --conf-path=/etc/aria2/aria2.conf
echo "Started"
else
echo "aria2cRPC already started"
fi
;;
stop)
echo "Stopping script aria2cRPC"
if [ ! -z "$ARIA_PID" ]; then
kill $ARIA_PID
fi
echo "OK"
;;
status)
if [ ! -z "$ARIA_PID" ]; then
echo "The aria2cRPC is running with PID = "$ARIA_PID
else
echo "No process found for aria2c RPC"
fi
;;
*)
echo "Usage: /etc/init.d/aria2cRPC {start|stop|status}"
exit 1
;;
esac
exit 0
rc.local
or atleast have some mechanism to make sure that network is up and running by the time you call your script. A recent very similar question (ie, usiing network services) : raspberrypi.stackexchange.com/questions/37424/… Hope it helps.