summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-aria2/root/usr/libexec/aria2-call
blob: eba7aea5ec0762f4ec9f37268df905252d98ce35 (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
#!/bin/sh

. "$IPKG_INSTROOT/usr/share/libubox/jshn.sh"

action=$1
shift

case "$action" in
	cat)
		case "$1" in
			conf|session)
				config_dir="$(uci -q get aria2.main.config_dir)"
				list_file="${config_dir:-/var/etc/aria2}/aria2.$1.main"
				json_init
				json_add_string file "$list_file"
				json_add_string content "$(cat "$list_file")"
				json_dump
			;;
		esac
	;;
	tail)
		log_file=$(uci -q get aria2.main.log)
		tail -n 50 "${log_file:-/var/log/aria2.log}"
	;;
esac