mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-08-01 07:07:52 +08:00
57 lines
1.4 KiB
Bash
Executable File
57 lines
1.4 KiB
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
|
|
START=99
|
|
STOP=01
|
|
USE_PROCD=1
|
|
|
|
NAME=fancontrol
|
|
PROG=/usr/bin/$NAME
|
|
|
|
start_service() {
|
|
config_load "$NAME"
|
|
|
|
local enabled
|
|
config_get enabled settings enabled
|
|
[ "$enabled" = "1" ] || { _info "Instance \"$NAME\" disabled."; return 1; }
|
|
|
|
local thermal_file
|
|
local fan_file
|
|
local start_temp
|
|
local start_speed
|
|
local max_speed
|
|
local temp_div
|
|
|
|
config_get thermal_file settings thermal_file
|
|
config_get fan_file settings fan_file
|
|
config_get start_temp settings start_temp
|
|
config_get start_speed settings start_speed
|
|
config_get max_speed settings max_speed
|
|
config_get temp_div settings temp_div
|
|
|
|
procd_open_instance
|
|
procd_set_param command $PROG
|
|
[ -n "$thermal_file" ] && procd_append_param command -T "$thermal_file"
|
|
[ -n "$fan_file" ] && procd_append_param command -F "$fan_file"
|
|
[ -n "$start_temp" ] && procd_append_param command -t "$start_temp"
|
|
[ -n "$start_speed" ] && procd_append_param command -s "$start_speed"
|
|
[ -n "$max_speed" ] && procd_append_param command -m "$max_speed"
|
|
[ -n "$temp_div" ] && procd_append_param command -d "$temp_div"
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
}
|
|
|
|
start() {
|
|
start_service
|
|
}
|
|
|
|
stop() {
|
|
procd_kill_instance
|
|
}
|
|
|
|
reload() {
|
|
procd_reload_instance
|
|
}
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger "fancontrol"
|
|
} |