🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=cpulimit configuration module
LUCI_DEPENDS:=+luci-compat +cpulimit
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,11 @@
module("luci.controller.cpulimit", package.seeall)
function index()
if not nixio.fs.access("/etc/config/cpulimit") then
return
end
local page = entry({"admin", "system", "cpulimit"}, cbi("cpulimit"), _("cpulimit"), 65)
page.dependent = true
page.acl_depends = { "luci-app-cpulimit" }
end
@@ -0,0 +1,38 @@
m = Map("cpulimit", translate("cpulimit"))
m.description = translate("cpulimit ")
s = m:section(TypedSection, "list", translate("Settings"))
s.template = "cbi/tblsection"
s.anonymous = true
s.addremove = true
enable = s:option(Flag, "enabled", translate("enable", "enable"))
enable.optional = false
enable.rmempty = false
exename = s:option(Value, "exename", translate("exename"), translate("name of the executable program file or path name"))
exename.optional = false
exename.rmempty = false
exename.default = "/usr/bin/transmission-daemon"
exename:value("transmission","/usr/bin/transmission-daemon")
exename:value("samba","/usr/sbin/smbd")
exename:value("mount.ntfs-3g","mount.ntfs-3g")
exename:value("vsftpd","/usr/sbin/vsftpd")
exename:value("pure-ftpd","/usr/sbin/pure-ftpd")
limit = s:option(Value, "limit", translate("limit"))
limit.optional = false
limit.rmempty = false
limit.default = "50"
limit:value("100","100%")
limit:value("90","90%")
limit:value("80","80%")
limit:value("70","70%")
limit:value("60","60%")
limit:value("50","50%")
limit:value("40","40%")
limit:value("30","30%")
limit:value("20","20%")
limit:value("10","10%")
return m
+1
View File
@@ -0,0 +1 @@
zh_Hans
+30
View File
@@ -0,0 +1,30 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-28\n"
"PO-Revision-Date: 2014-06-28\n"
"Last-Translator: Syrone Wong <wong.syrone@gmail.com>\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
msgid "cpulimit"
msgstr "CPU占用率限制"
msgid "Use cpulimit to restrict app's cpu usage."
msgstr "利用cpulimit限制应用程序的CPU使用率"
msgid "Usage restrictions"
msgstr "使用率限制"
msgid "exename"
msgstr "进程名称"
msgid "name of the executable program file or path name"
msgstr "可执行文件名称。不能是应用程序路径!"
msgid "limit"
msgstr "占用率限制"
@@ -0,0 +1,6 @@
config 'list'
option 'exename' '/usr/bin/transmission-daemon'
option 'limit' '50'
option 'enabled' '0'
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
. /lib/functions.sh
START=50
DEFAULT=/etc/default/cpulimit
start() {
/usr/bin/cpulimit.sh start &
}
stop() {
kill -9 `pidof cpulimit | sed "s/$$//g"`
}
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
. /lib/functions.sh
cpulimit_get(){
echo cpulimit_get
config_get enabled $1 enabled
[ $enabled -gt 0 ] || return 1
config_get limit $1 limit
config_get exename $1 exename
cpulimit -l $limit -e $exename &
echo cpulimit -l $limit -e $exename
}
stop() {
killall -9 cpulimit
# ps -a|grep cpulimit|while read line
# do
# killall cpulimit>/dev/null 2>&1
# done
}
case "$1" in
"start")
echo start
killall -9 cpulimit
config_load cpulimit
config_foreach cpulimit_get list
echo end
exit 0
;;
"stop")echo stop; killall -9 cpulimit;;
esac
@@ -0,0 +1,11 @@
{
"luci-app-cpulimit": {
"description": "Grant UCI access for luci-app-cpulimit",
"read": {
"uci": [ "cpulimit" ]
},
"write": {
"uci": [ "cpulimit" ]
}
}
}
@@ -0,0 +1,4 @@
{
"config": "cpulimit",
"init": "cpulimit"
}