aboutsummaryrefslogtreecommitdiffstats
path: root/main/aria2/aria2.initd
blob: c8e2edcc2f99ab8237ccab97c196a526a8fdf51a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/sbin/openrc-run

: ${cfgfile:="/etc/aria2.conf"}
: ${logfile:="/var/log/aria2.log"}
: ${command_user:="aria2"}

command="/usr/bin/aria2c"
command_args="
	--enable-rpc=true
	--quiet=true
	--log=$logfile
	--conf-path=$cfgfile
	${command_args:-}"
command_background="yes"

pidfile="/run/$RC_SVCNAME.pid"
output_log="/dev/null"
error_log="/dev/null"
start_stop_daemon_args="--env XDG_CACHE_HOME=/var/cache"

required_files="$cfgfile"

depend() {
	need net
	use dns netmount
}

start_pre() {
	local _logfile=$(sed -En 's|^log=([^#]+)|\1|p' "$cfgfile")

	checkpath -f -m 640 -o "$command_user" "${_logfile:-$logfile}"
}