如何从“dash”可执行文件中删除密码要求并将其添加到 dock

如何从“dash”可执行文件中删除密码要求并将其添加到 dock

我有 7 个用于风扇控制的文件,其中包含以下几行:

#!/bin/dash
echo level k | sudo tee /proc/acpi/ibm/fan

之后kecho level1 至 7

脚本运行良好,但每次都会要求输入 sudo 密码。如何从这些文件中删除密码?
是否可以将这些文件附加到 dock,以便单击激活它们?

操作系统是 Ubuntu 20.04

编辑
ps auxc | grep -i therm给出

root         153  0.0  0.0      0     0 ?        I<   May24   0:00 acpi_thermal_pm
root        6491  0.0  0.0 128404  1360 ?        Ssl  May24   0:02 thermald

编辑2 sensors给出

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +54.0°C  (high = +87.0°C, crit = +105.0°C)
Core 0:        +54.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1:        +51.0°C  (high = +87.0°C, crit = +105.0°C)

BAT0-acpi-0
Adapter: ACPI interface
in0:          12.54 V  

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        2997 RPM
temp1:        +51.0°C  
temp2:         +0.0°C  
temp3:         +0.0°C  
temp4:         +0.0°C  
temp5:         +0.0°C  
temp6:         +0.0°C  
temp7:         +0.0°C  
temp8:         +0.0°C  

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +51.0°C  (crit = +103.0°C)

编辑3
输出sudo dmidecode -s bios-version

G2ETA7WW (2.67 )

该笔记本电脑是Lenovo Thinkpad x230x64 的。

编辑4 top命令:

top 命令

编辑5

sysctl vm.swappiness给出 vm.swappiness = 60

ls -al ~/.local/share/gnome-shell/extensions给出

cannot access '/home/user/.local/share/gnome-shell/extensions': No such file or directory

ls -al /usr/share/gnome-shell/extensions给出

total 20
drwxr-xr-x 5 root root 4096 May  8 17:31 .
drwxr-xr-x 7 root root 4096 May  8 17:46 ..
drwxr-xr-x 2 root root 4096 May  8 17:31 desktop-icons@csoriano
drwxr-xr-x 3 root root 4096 May  8 15:37 [email protected]
drwxr-xr-x 3 root root 4096 May 31 09:10 [email protected]

编辑6

snap list

    Name                             Version                     Rev   Tracking          Publisher            Notes
canonical-livepatch              9.5.5                       95    latest/stable     canonical✓           -
checkbox                         1.13                        838   latest/stable     ce-certification-qa  -
checkbox-snappy                  18.14                       2012  latest/stable     ce-certification-qa  -
chromium                         83.0.4103.61                1165  latest/stable     canonical✓           -
code                             5763d909                    33    latest/stable     vscode✓              classic
core                             16-2.44.3                   9066  latest/stable     canonical✓           core
core18                           20200427                    1754  latest/stable     canonical✓           base
gnome-3-26-1604                  3.26.0.20200529             100   latest/stable/…   canonical✓           -
gnome-3-28-1804                  3.28.0-16-g27c9498.27c9498  116   latest/stable     canonical✓           -
gnome-3-34-1804                  0+git.3009fc7               33    latest/stable     canonical✓           -
gnome-system-monitor             3.36.0-12-g35f88a56d7       145   latest/stable/…   canonical✓           -
gtk-common-themes                0.1-36-gc75f853             1506  latest/stable/…   canonical✓           -
htop                             2.2.0                       1207  latest/stable     maxiberta            -
kde-frameworks-5-core18          5.61.0                      32    latest/stable     kde✓                 -
kde-frameworks-5-qt-5-14-core18  5.68.0                      4     latest/stable     kde✓                 -
kolourpaint                      20.04.0                     56    latest/candidate  kde✓                 -
notepad-plus-plus                7.8.6                       232   latest/stable     mmtrt                -
odrive-unofficial                0.2.0                       2     latest/stable     ishan-bn14           -
pdftk                            2.02-4                      9     latest/stable     smoser               -
qalculate                        3.10.0                      248   latest/stable     h-k                  -
skype                            8.60.0.76                   128   latest/stable     skype✓               classic
snap-store                       3.36.0-80-g208fd61          454   latest/stable/…   canonical✓           -
submission-service               1.1                         12    latest/stable     codersquid           -
vlc                              3.0.10                      1620  latest/stable     videolan✓            -
whatsdesk                        0.2.18                      17    latest/stable     zerkc                -
wine-platform-3-stable           3.0.4                       6     latest/stable     mmtrt                -
wine-platform-5-stable           5.0.0                       4     latest/stable     mmtrt                -
wine-platform-i386               1.0                         25    latest/stable     mmtrt                -
wine-platform-runtime            v1.0                        136   latest/stable     mmtrt                -
zoom-client                      5.0.413237.0524             83    latest/stable     ogra                 -

dpkg-query: no packages found matching *discord*

top 命令

答案1

真实的问题是:风扇有时噪音太大

thermald

ps auxc | grep -i therm

root         153  0.0  0.0      0     0 ?        I<   May24   0:00 acpi_thermal_pm
root        6491  0.0  0.0 128404  1360 ?        Ssl  May24   0:02 thermald

您有两个热过程处理热事件。清除thermald...

sudo apt-get purge thermald

传感器

安装后lm-sensors,命令的输出sensors看起来不错。

Package id 0:  +54.0°C  (high = +87.0°C, crit = +105.0°C)
Core 0:        +54.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1:        +51.0°C  (high = +87.0°C, crit = +105.0°C)

BIOS

您有 BIOS G2ETA7WW (2.67)。

BIOS v2.77 现已可用这里有多种不同的格式。更新 BIOS 可能会解决风扇噪音问题。

fan1:        2997 RPM

注意:更新 BIOS 之前请做好备份。

更新#1:

将您的脚本修改为 .desktop 文件,并将它们放在 ~/.local/share/applications 中。然后,您可以Super像普通应用程序一样从密钥运行它们,和/或将它们放入 dock 中。仍然需要 Sudo。

粗略的例子...粉丝#7.桌面...

[Desktop Entry]
Version=1.0
Name=Fan#7
Comment=Fan Control
Icon=/path_to/fan_icon
Exec=sh -c "echo level 7 | sudo tee /proc/acpi/ibm/fan"
Terminal=true
Type=Application
Categories=GNOME;System;Utility;

您还需要获取新 .desktop 文件的属性,并启用“允许将文件作为程序执行”。

相关内容