added startup script for a firejailed aria2

This commit is contained in:
Tobias Schmidl 2019-02-15 10:51:56 +01:00
parent 16a36003bc
commit 9f12e895f5
2 changed files with 35 additions and 0 deletions

1
.local/bin/aria2.daemon Symbolic link
View file

@ -0,0 +1 @@
../share/aria2/aria2.daemon

34
.local/share/aria2/aria2.daemon Executable file
View file

@ -0,0 +1,34 @@
#! /bin/bash
RUNDIR="${XDG_DOCUMENTS_DIR:-$HOME/.local/share}/aria2"
SESSION_FILE="$RUNDIR/aria2.session"
LOG_FILE="${LOG_FILE:-$RUNDIR/aria2.log}"
[ ! -d $RUNDIR ] && mkdir $RUNDIR
[ ! -d $RUNDIR ] && { echo "Cannot create runtime dir $RUNDIR." >&2; exit 1; }
# if log size is not readable or too large, recreate it empty
[ "$LOG_FILE" != "-" ] && truncate -s0 $LOG_FILE
[ ! -r $LOG_FILE -a "$LOG_FILE" != "-" ] && { echo "Cannot create log file $LOG_FILE." >&2; exit 1; }
[ ! -r $SESSION_FILE ] && touch $SESSION_FILE
[ ! -r $SESSION_FILE ] && { echo "Cannot create session file $SESSION_FILE." >&2; exit 1; }
exec firejail --name=aria2 --ignore=netfilter --ignore=private-cache --private-etc=ca-certificates,ssl,nsswitch.conf,resolv.conf,hosts aria2c \
--async-dns=false \
--bt-enable-lpd=true \
--check-integrity=true \
--continue \
--dir="$HOME"/Downloads \
--disable-ipv6 \
--enable-http-pipelining=true \
--enable-rpc=true \
--file-allocation=falloc \
--http-accept-gzip=true \
--input-file="$SESSION_FILE" \
--log="$LOG_FILE" \
--log-level=notice \
--max-concurrent-downloads=3 \
--quiet=true \
--remote-time=true \
--rpc-secret=t4fGJIbc8Rruik2hki87R6UiVUPUwmEX2Mr7gadVYBQz7BJtplDof1CNfzZCqPR2zxteycSvlC8OhC4kOokrBY15pjjvlWsIqkDX \
--save-session-interval=120 \
--save-session="$SESSION_FILE"