amended README to have a better openrc service example

This commit is contained in:
celso 2022-11-19 12:54:22 -03:00
parent 4e522dc30b
commit 855a355041
1 changed files with 28 additions and 9 deletions

View File

@ -35,18 +35,37 @@ Once the temperature goes back down and it reaches the minimum threshold, the pr
You must provide the temperature at which you wish to step down the maximum frequency as first argument, and the temperature at which you wish to step up the maximum frequency as second argument; like so:
`homemade_speedstep <max temp> <min temp>`
<hr>
---
**Recomendation**: add a service to your init script that runs this program at startup in the background so you don't need to keep a terminal emulator open running it.
Using OpenRC this would be done by adding the following in a `/etc/init.d/homemade_speedstep` file:
```
#!/sbin/openrc-run
start() {
/usr/bin/homemade_speedstep ${HSMAXTEMP} ${HSMINTEMP} >/dev/null 2>&1
#/sbin/openrc-run
name="homemade_speedstep"
description="crude imitation of intel's speedstep"
command="/usr/bin/homemade_speedstep"
command_args="${HSMAXTEMP} ${HSMINTEMP}"
command_background=true
checkconfig() {
if [ ${HSMAXTEMP} -lt 100000 ] && [ ${HSMINTEMP} -lt ${HSMAXTEMP} ]
then return 0
fi
return 1
}
stop() {
killall homemade_speedstep >/dev/null 2>&1
start_pre() {
# Prevent of double check
if [ "${RC_CMD}" != "restart" ] ; then
checkconfig || return $?
fi
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return $?
fi
}
```
and the following in a `/etc/conf.d/homemade_speedstep` file:
@ -54,8 +73,8 @@ and the following in a `/etc/conf.d/homemade_speedstep` file:
# /etc/conf.d/homemade_speedstep: config gile for /etc/init.d/homemade_speedstep
# Change these to your liking
# Upper temperature threshold
$HSMAXTEMP=82000
HSMAXTEMP=82000
# Lower temperature threshold
$HSMINTEMP=70000
HSMINTEMP=70000
```
and finally running `rc-update add homemade_speedstep default`