#!/bin/ash
if ! [ -z $NGINX_LISTEN_SOCKET ]; then
sed -i 's#listen 80#listen unix:/var/run/nginx.sock#' /etc/nginx/conf.d/default.conf
fi
nginx
touch /data/torrents
chown $UID /data/torrents
su-exec $UID aria2c \
--quiet \
--enable-rpc \
--bt-save-metadata \
--bt-load-saved-metadata \
--force-save \
--listen-port=6881-6889 \
--summary-interval=0 \
--seed-ratio=0 \
--dir /data/ \
--save-session /data/torrents \
-i /data/torrents