diff --git a/README.md b/README.md index dc16d84..cbf2892 100644 --- a/README.md +++ b/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: `homemade_speedstep ` -
+--- **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` +and finally running `rc-update add homemade_speedstep default` \ No newline at end of file