---
title: "Tuxedo Computer : Script bash pour comprendre pourquoi le bruit du ventilateur"
url: https://www.cyber-neurones.org/2020/03/tuxedo-computer-script-bash-pour-comprendre-pourquoi-le-bruit-du-ventilateur/
date: 2020-03-21
modified: 2020-03-22
author: "Frederic"
description: "Voici donc le script que j'ai fait : #!/bin/bash # # MariaDB [mysql]> create database CPU; # Query OK, 1 row affected (0.00 sec) # MariaDB [(none)]> CREATE USER 'arias'@'localhost'..."
categories:
  - "Ubuntu"
tags:
  - "CPU"
  - "Fan"
  - "TUXEDO"
word_count: 455
---

# Tuxedo Computer : Script bash pour comprendre pourquoi le bruit du ventilateur

Voici donc le script que j'ai fait :
#!/bin/bash

#
# MariaDB [mysql]> create database CPU;
# Query OK, 1 row affected (0.00 sec)

# MariaDB [(none)]> CREATE USER 'arias'@'localhost' IDENTIFIED BY 'arias';
# Query OK, 0 rows affected (0.00 sec)

# MariaDB [(none)]> GRANT USAGE ON *.* TO 'arias'@'localhost' IDENTIFIED BY 'arias';
# Query OK, 0 rows affected (0.00 sec)

# MariaDB [(none)]> GRANT ALL privileges ON CPU.* TO 'arias'@'localhost';
# Query OK, 0 rows affected (0.00 sec)

# MariaDB [(none)]> FLUSH PRIVILEGES;
# Query OK, 0 rows affected (0.00 sec)
#
#
#mysql -u root -e "CREATE DATABASE CPU;"
#mysql -u root -e "USE CPU; CREATE TABLE information (date datetime, cpu float, fanId int, rawFanDuty int, fanDuty float, remoteTemp int, localTemp int);"

**CPU_USAGE=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' <(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat))**
DATE=$(date "+%Y-%m-%d %H:%M:%S")
CPU_USAGE_2=$(echo $CPU_USAGE | sed 's/%//g' )
**/usr/bin/tuxedofancontrol** --show > /tmp/tuxedofancontrol.out
FANID=$(cat /tmp/tuxedofancontrol.out | grep "fanId" | awk '{print $2}' | sed 's/,//g')
RAWFANDUTY=$(cat /tmp/tuxedofancontrol.out | grep "rawFanDuty" | awk '{print $2}' | sed 's/,//g' )
FANDUTY=$(cat /tmp/tuxedofancontrol.out | grep "fanDuty" | awk '{print $2}' | sed 's/,//g')
REMOTETEMP=$(cat /tmp/tuxedofancontrol.out | grep "remoteTemp:" | awk '{print $2}' | sed 's/,//g')
LOCALTEMP=$(cat /tmp/tuxedofancontrol.out | grep "localTemp:" | awk '{print $2}' | sed 's/,//g' )

if [ ! -z $FANID ]
then
SQL="USE CPU; INSERT INTO information (date, cpu, fanId, rawFanDuty, fanDuty, remoteTemp, localTemp) VALUES ('$DATE',$CPU_USAGE_2,$FANID,$RAWFANDUTY,$FANDUTY,$REMOTETEMP,$LOCALTEMP);"
else
SQL="USE CPU; INSERT INTO information (date, cpu) VALUES ('$DATE',$CPU_USAGE_2);"
fi

echo $SQL > /tmp/lastsql.out
mysql -u root -e "$SQL"

C'est assez simple, je prends la date et l'utilisation du CPU. Et aussi je note toutes les informations de tuxedofancontrol.
J'ai mis le script toutes les 2 minutes dans ma crontab, ensuite je ferai un script pour Grafana.
$ **sudo crontab -l**
*/2 * * * * /home/arias/Bash/cpu.bash

Par exemple :

[![](https://www.cyber-neurones.org/wp-content/uploads/2020/03/screenshot-from-2020-03-21-12-02-31-1024x446.png)](https://www.cyber-neurones.org/wp-content/uploads/2020/03/screenshot-from-2020-03-21-12-02-31.png)

A suivre.

Visiblement je ne suis pas le seul à trouver le ventilateur un peu trop bruyant : [https://www.tuxedocomputers.com/en/Infos/Help-Support/Frequently-asked-questions/Why-is-the-ventilator-so-loud-.tuxedo](https://www.tuxedocomputers.com/en/Infos/Help-Support/Frequently-asked-questions/Why-is-the-ventilator-so-loud-.tuxedo) .
> ## Why is the ventilator so loud?
>
>
>
>
>
>
> **IMPORTANT: There are ventilation slots on the bottom side through which the ventilator(s) suck in air. Never place your notebook on a pillow, couch, bed, blanket or tablecloth. In the worst case scenario, the notebook can overheat and cause serious damage.**
>
> **The ventilator noise depends largely on the system load**. If the processor has to work a lot, it consumes a lot of power, which leads to increased waste heat that somehow has to be cooled. If the ventilation slots are covered, the ventilator(s) cannot suck in any air. This has a negative effect on the cooling performance, the ventilator(s) must rotate faster to provide sufficient cooling and the noise level is significantly higher.