amended README to have a better openrc service example
This commit is contained in:
parent
4e522dc30b
commit
855a355041
35
README.md
35
README.md
|
@ -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:
|
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>`
|
`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.
|
**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:
|
Using OpenRC this would be done by adding the following in a `/etc/init.d/homemade_speedstep` file:
|
||||||
```
|
```
|
||||||
#!/sbin/openrc-run
|
#/sbin/openrc-run
|
||||||
start() {
|
name="homemade_speedstep"
|
||||||
/usr/bin/homemade_speedstep ${HSMAXTEMP} ${HSMINTEMP} >/dev/null 2>&1
|
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:
|
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
|
# /etc/conf.d/homemade_speedstep: config gile for /etc/init.d/homemade_speedstep
|
||||||
# Change these to your liking
|
# Change these to your liking
|
||||||
# Upper temperature threshold
|
# Upper temperature threshold
|
||||||
$HSMAXTEMP=82000
|
HSMAXTEMP=82000
|
||||||
# Lower temperature threshold
|
# Lower temperature threshold
|
||||||
$HSMINTEMP=70000
|
HSMINTEMP=70000
|
||||||
```
|
```
|
||||||
and finally running `rc-update add homemade_speedstep default`
|
and finally running `rc-update add homemade_speedstep default`
|
Loading…
Reference in New Issue