fixed README again and added openrc service

This commit is contained in:
celso 2022-11-19 13:22:12 -03:00
parent 855a355041
commit f6a794363f
4 changed files with 43 additions and 6 deletions

View File

@ -15,5 +15,9 @@ debug:
install:
cp $(BINDIR)/$(BIN) /usr/bin/$(BIN)
install-openrc:
cp init.d/$(BIN) /etc/init.d/$(BIN)
cp conf.d/$(BIN) /etc/conf.d/$(BIN)
clean:
$(RM) -r $(BINDIR)/*

View File

@ -41,18 +41,18 @@ You must provide the temperature at which you wish to step down the maximum freq
Using OpenRC this would be done by adding the following in a `/etc/init.d/homemade_speedstep` file:
```
#/sbin/openrc-run
#!/sbin/openrc-run
name="homemade_speedstep"
description="crude imitation of intel's speedstep"
command="/usr/bin/homemade_speedstep"
command=/usr/bin/homemade_speedstep
command_args="${HSMAXTEMP} ${HSMINTEMP}"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
checkconfig() {
if [ ${HSMAXTEMP} -lt 100000 ] && [ ${HSMINTEMP} -lt ${HSMAXTEMP} ]
then return 0
if [ ${HSMAXTEMP} -lt 100000 ] && [ ${HSMINTEMP} -lt ${HSMAXTEMP} ] ; then
return 0
fi
return 1
}
start_pre() {

View File

@ -0,0 +1,7 @@
# /etc/conf.d/homemade_speedstep: config gile for /etc/init.d/homemade_speedstep
# Change these to your liking
# Upper temperature threshold
HSMAXTEMP=82000
# Lower temperature threshold
HSMINTEMP=70000

26
init.d/homemade_speedstep Executable file
View File

@ -0,0 +1,26 @@
#!/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
pidfile="/run/${RC_SVCNAME}.pid"
checkconfig() {
if [ ${HSMAXTEMP} -lt 100000 ] && [ ${HSMINTEMP} -lt ${HSMAXTEMP} ] ; then
return 0
fi
}
start_pre() {
# Prevent of double check
if [ "${RC_CMD}" != "restart" ] ; then
checkconfig || return $?
fi
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return $?
fi
}