> Кусок кода полностью сюда приложи. Тут systemd не при чём скорее всего.
> (при всей моей нелюбви к поттерингу) Ну раз кусок полностью :) то проще весь код дать:
#!/bin/dash
#bu VINRARUS
CPU=/sys/class/hwmon/hwmon3/pwm1
BIG=/sys/class/hwmon/hwmon3/pwm2
if grep k10temp /sys/class/hwmon/hwmon0/name
then
sCORE=/sys/class/hwmon/hwmon0/temp1_input
elif grep k10temp /sys/class/hwmon/hwmon1/name
then
sCORE=/sys/class/hwmon/hwmon1/temp1_input
else
echo "not find k10temp"
exit 2
fi
sCPU=/sys/class/hwmon/hwmon3/temp3_input
sGPU=/sys/class/hwmon/hwmon2/temp1_input
sMB=/sys/class/hwmon/hwmon3/temp2_input
CPUFAN(){
TT=0
for T in $c1 $c2 $c3 $c
do
if [ "$T" -gt "$TT" ]
then
TT=$T
fi
done
if [ "$TT" != "$CPUpwm" ]
then
CPUpwm="$TT"
echo "$CPUpwm" > $CPU
fi
}
MOTOFAN(){
TT=0
T=0
for T in $m1 $m2 $m3 $m
do
if [ "$T" -gt "$TT" ]
then
TT="$T"
fi
done
if [ "$TT" != "$MOTOpwm" ]
then
MOTOpwm="$TT"
echo "$MOTOpwm" > $BIG
fi
}
if [ -f "$sCORE" -a -f "$sGPU" -a -f "$sMB" -a -f "$CPU" -a -f "$BIG" -a -f "${CPU}_enable" -a -f "${BIG}_enable" ]
then
if [ "$1" = "stop" ]
then
echo 254 > ${CPU}
echo 254 > ${BIG}
echo "max fan"
echo 2 > ${CPU}_enable
echo 2 > ${BIG}_enable
echo "fan autocontrol"
exit
fi
echo "Use: $0 -log"
echo "Enable fan pwm control..."
echo 1 > ${CPU}_enable
echo 1 > ${BIG}_enable
else
echo "Fan control blocked!"
exit 4
fi
while true
do
read -t 1 D
##sleep 1
read tCORE x <$sCORE
# read tCPU x <$sCPU
read tMB x <$sMB
read tGPU x <$sGPU
tCORE=${tCORE%???}
tMB=${tMB%???}
tGPU=${tGPU%???}
###############tCORE#################
case "$tCORE" in
[0-9]|[0-3][0-9])
m1=90
c1=90
;;
4[0-9])
m1=90
c1="$(((${tCORE#?}+1)*5/2+90))"
;;
5[0-9])
m1="$(((${tCORE#?}+1)*5+90))"
c1="$(((${tCORE#?}+1)*5+115))"
;;
6[0-4])
m1="$(((${tCORE#?}+1)*8+140))"
c1="$(((${tCORE#?}+1)*15+165))"
;;
6[5-9])
m1="$(((${tCORE#?}+1)*10+150))"
c1="254"
;;
*)
m1=254
c1=254
;;
esac
################tMB################
case "$tMB" in
[0-9]|[0-3][0-9])
m2=90
c2=90
;;
4[0-9])
m2=90
c2="$(((${tMB#?}+1)*5/2+90))"
;;
5[0-9])
m2="$(((${tMB#?}+1)*5+90))"
c2="$(((${tMB#?}+1)*5+115))"
;;
6[0-4])
m2="$(((${tMB#?}+1)*8+140))"
c2="$(((${tMB#?}+1)*15/2+165))"
;;
6[5-9])
m2="$(((${tMB#?}+1)*10+150))"
c2="$(((${tMB#?}+1)*15/2+165))"
;;
*)
m2=254
c2=254
;;
esac
################tGPU################
case "$tGPU" in
[0-9]|[0-4][0-9])
m3=90
c3=90
;;
5[0-9])
m3="$((${tGPU#?}+91))"
c3=90
;;
6[0-9])
m3="$((${tGPU#?}+101))"
c3=90
;;
7[0-9])
m3="$(((${tGPU#?}+1)*2+110))"
c3=90
;;
8[0-9])
m3="$(((${tGPU#?}+1)*10+130))"
c3="$(((${tGPU#?}+1)*10+100))"
;;
*)
m3=254
c3=254
;;
esac
################analiz################
CPUFAN
MOTOFAN
if [ "$1" = "-log" ]
then
echo "BIG:$MOTOpwm \n CPU:$CPUpwm
$m1 $m2 $m3 \n $c1 $c2 $c3"
fi
done