lede/package/lean/luci-app-baidupcs-web/root/etc/init.d/baidupcs-web
Beginner 1ba0b9f626
luci-app-baidupcs-web: Fix UCI is incorrect in the system log (#8515)
daemon.notice procd: /etc/rc.d/S90baidupcs-web: uci: Entry not found

Co-authored-by: zxlhhyccc <45259624+zxlhhyccc@users.noreply.github.com>
2021-12-24 14:59:31 +08:00

33 lines
1.1 KiB
Bash
Executable File

#!/bin/sh /etc/rc.common
START=90
STOP=10
enabled="$(uci -q get baidupcs-web.config.enabled)"
port="$(uci -q get baidupcs-web.config.port)"
download_dir="$(uci -q get baidupcs-web.config.download_dir)"
max_download_rate="$(uci -q get baidupcs-web.config.max_download_rate || echo '0')"
max_upload_rate="$(uci -q get baidupcs-web.config.max_upload_rate || echo '0')"
max_download_load="$(uci -q get baidupcs-web.config.max_download_load || echo '1')"
max_parallel="$(uci -q get baidupcs-web.config.max_parallel || echo '8')"
start() {
stop
[ "$enabled" == "1" ] || exit 0
mkdir -p "${download_dir}"
baidupcs-web config set \
--savedir "${download_dir}" \
--max_download_rate "${max_download_rate}" \
--max_upload_rate "${max_upload_rate}" \
--max_download_load "${max_download_load}" \
--max_parallel "${max_parallel}" \
--max_upload_parallel "${max_parallel}" \
>/dev/null 2>&1
baidupcs-web web --port "${port}" --access >/dev/null 2>&1 &
}
stop() {
killall baidupcs-web >/dev/null 2>&1
}