luci-app-alist: add delayed start options
This commit is contained in:
parent
a5837a2014
commit
deeaee4eae
@ -6,7 +6,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-alist
|
PKG_NAME:=luci-app-alist
|
||||||
PKG_VERSION:=1.0.8
|
PKG_VERSION:=1.0.9
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI support for alist
|
LUCI_TITLE:=LuCI support for alist
|
||||||
|
@ -47,6 +47,11 @@ o.datatype = "and(uinteger,min(1))"
|
|||||||
o.default = "48"
|
o.default = "48"
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
|
||||||
|
o = s:option(Value, "delayed_start", translate("Delayed Start (seconds)"))
|
||||||
|
o.datatype = "and(uinteger,min(0))"
|
||||||
|
o.default = "0"
|
||||||
|
o.rmempty = false
|
||||||
|
|
||||||
o = s:option(Value, "temp_dir", translate("Cache directory"))
|
o = s:option(Value, "temp_dir", translate("Cache directory"))
|
||||||
o.datatype = "string"
|
o.datatype = "string"
|
||||||
o.default = "/tmp/alist"
|
o.default = "/tmp/alist"
|
||||||
|
@ -90,3 +90,6 @@ msgstr "站点 URL"
|
|||||||
|
|
||||||
msgid "When the web is reverse proxied to a subdirectory, this option must be filled out to ensure proper functioning of the web. Do not include '/' at the end of the URL"
|
msgid "When the web is reverse proxied to a subdirectory, this option must be filled out to ensure proper functioning of the web. Do not include '/' at the end of the URL"
|
||||||
msgstr "Web 被反向代理到二级目录时,必须填写该选项以确保 Web 正常工作。URL 结尾请勿携带 '/'"
|
msgstr "Web 被反向代理到二级目录时,必须填写该选项以确保 Web 正常工作。URL 结尾请勿携带 '/'"
|
||||||
|
|
||||||
|
msgid "Delayed Start (seconds)"
|
||||||
|
msgstr "开机延时启动(秒)"
|
||||||
|
@ -6,3 +6,4 @@ config alist
|
|||||||
option 'token_expires_in' '48'
|
option 'token_expires_in' '48'
|
||||||
option 'max_connections' '0'
|
option 'max_connections' '0'
|
||||||
option 'site_url' ''
|
option 'site_url' ''
|
||||||
|
option 'delayed_start' '0'
|
||||||
|
@ -17,6 +17,7 @@ get_config() {
|
|||||||
config_get token_expires_in $1 token_expires_in 48
|
config_get token_expires_in $1 token_expires_in 48
|
||||||
config_get allow_wan $1 allow_wan 0
|
config_get allow_wan $1 allow_wan 0
|
||||||
config_get max_connections $1 max_connections 0
|
config_get max_connections $1 max_connections 0
|
||||||
|
config_get delayed_start $1 delayed_start 0
|
||||||
config_load network
|
config_load network
|
||||||
config_get lan_addr lan ipaddr "0.0.0.0"
|
config_get lan_addr lan ipaddr "0.0.0.0"
|
||||||
if echo "${lan_addr}" | grep -Fq ' '; then
|
if echo "${lan_addr}" | grep -Fq ' '; then
|
||||||
@ -52,6 +53,11 @@ start_service() {
|
|||||||
mkdir -p $temp_dir
|
mkdir -p $temp_dir
|
||||||
[ "$ssl" -eq 1 ] && SSL=true || SSL=false
|
[ "$ssl" -eq 1 ] && SSL=true || SSL=false
|
||||||
[ "$log" -eq 1 ] && LOG=true || LOG=false
|
[ "$log" -eq 1 ] && LOG=true || LOG=false
|
||||||
|
if [ -e /proc/uptime ]; then
|
||||||
|
[ $(awk -F. '{print $1}' /proc/uptime) -lt "120" ] && delayed_start=$delayed_start || delayed_start=0
|
||||||
|
else
|
||||||
|
delayed_start=$delayed_start
|
||||||
|
fi
|
||||||
if [ "$allow_wan" -eq "1" ]; then
|
if [ "$allow_wan" -eq "1" ]; then
|
||||||
listen_addr="0.0.0.0"
|
listen_addr="0.0.0.0"
|
||||||
external_access="allow"
|
external_access="allow"
|
||||||
@ -62,7 +68,7 @@ start_service() {
|
|||||||
set_firewall
|
set_firewall
|
||||||
cat /dev/null > $temp_dir/alist.log
|
cat /dev/null > $temp_dir/alist.log
|
||||||
cat > $CONFIG_DIR/config.json <<EOF
|
cat > $CONFIG_DIR/config.json <<EOF
|
||||||
{"force":false,"address":"$listen_addr","port":$port,"https_port":$port,"site_url":"$site_url","cdn":"","jwt_secret":"","token_expires_in":$token_expires_in,"database":{"type":"sqlite3","host":"","port":0,"user":"","password":"","name":"","db_file":"/etc/alist/data.db","table_prefix":"x_","ssl_mode":""},"scheme":{"disable_http":$SSL,"https":$SSL,"cert_file":"$ssl_cert","key_file":"$ssl_key"},"temp_dir":"$temp_dir","log":{"enable":$LOG,"name":"$temp_dir/alist.log","max_size":10,"max_backups":5,"max_age":28,"compress":false},"max_connections":$max_connections}
|
{"force":false,"address":"$listen_addr","port":$port,"https_port":$port,"site_url":"$site_url","cdn":"","jwt_secret":"","token_expires_in":$token_expires_in,"database":{"type":"sqlite3","host":"","port":0,"user":"","password":"","name":"","db_file":"/etc/alist/data.db","table_prefix":"x_","ssl_mode":""},"scheme":{"disable_http":$SSL,"https":$SSL,"cert_file":"$ssl_cert","key_file":"$ssl_key"},"temp_dir":"$temp_dir","log":{"enable":$LOG,"name":"$temp_dir/alist.log","max_size":10,"max_backups":5,"max_age":28,"compress":false},"delayed_start":$delayed_start,"max_connections":$max_connections}
|
||||||
EOF
|
EOF
|
||||||
procd_open_instance alist
|
procd_open_instance alist
|
||||||
procd_set_param command $PROG
|
procd_set_param command $PROG
|
||||||
|
Loading…
Reference in New Issue
Block a user