Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
toshiba_satellite_u500-17d [Le 11/09/2022, 11:25]
moths-art Suppression des espaces en fin de ligne (détecté et corrigé via le bot wiki-corrector (https://forum.ubuntu-fr.org/viewtopic.php?id=2067892)
toshiba_satellite_u500-17d [Le 08/10/2022, 17:06] (Version actuelle)
Amiralgaby [Ventilateur] deprecated egrep - trouvé avec wiki-corrector + amélioration du script
Ligne 50: Ligne 50:
 <file bash> <file bash>
 #!/bin/sh #!/bin/sh
 + 
 ### BEGIN INIT INFO ### BEGIN INIT INFO
 # Provides: ​         mando # Provides: ​         mando
Ligne 60: Ligne 60:
 # Description: ​      tweak to improve cooling # Description: ​      tweak to improve cooling
 ### END INIT INFO ### END INIT INFO
 + 
 . /​lib/​lsb/​init-functions . /​lib/​lsb/​init-functions
 + 
 [ -f /​etc/​default/​rcS ] && . /​etc/​default/​rcS [ -f /​etc/​default/​rcS ] && . /​etc/​default/​rcS
 PATH=/​bin:/​usr/​bin:/​sbin:/​usr/​sbin PATH=/​bin:/​usr/​bin:/​sbin:/​usr/​sbin
 + 
 COOLING_DEVICES_DIR="/​sys/​devices/​virtual/​thermal"​ COOLING_DEVICES_DIR="/​sys/​devices/​virtual/​thermal"​
-SERVICE_NAME="​$(basename $0)" +SERVICE_NAME="​$(basename ​"$0")" 
 + 
 case "​$1"​ in case "​$1"​ in
   start)   start)
     log_begin_msg "​Preparing cooling device"​     log_begin_msg "​Preparing cooling device"​
 + 
     for x in $(find $COOLING_DEVICES_DIR | grep cur_state)     for x in $(find $COOLING_DEVICES_DIR | grep cur_state)
     do     do
-      device_dir="​$(dirname $x)" +      device_dir="​$(dirname ​"$x")" 
-      num_device="​$(echo $device_dir ​| egrep -o "​cooling_device[0-9]+" | egrep -o "[0-9]+")" +      num_device="​$(echo ​"$device_dir"​ | grep -Eo '[0-9]+$')" 
-      max_state="​$(cat $device_dir/​max_state)"​+      max_state="​$(cat ​"$device_dir"/​max_state)"​
       new_state="​0"​       new_state="​0"​
-      if [ $num_device -gt 4 ]+      if [ "$num_device" ​-gt 4 ]
       then       then
           new_state=$max_state           new_state=$max_state
       fi       fi
-      ​echo -n $new_state > $device_dir/​cur_state;+      ​printf "​%s"​ "$new_state" ​"$device_dir/​cur_state"
     done     done
 + 
     log_end_msg 0     log_end_msg 0
     ;;     ;;
Ligne 99: Ligne 99:
     exit 1     exit 1
 esac esac
 + 
 exit 0 exit 0
 </​file>​ </​file>​
  • toshiba_satellite_u500-17d.1662888317.txt.gz
  • Dernière modification: Le 11/09/2022, 11:25
  • par moths-art