英伟达 nvidia jetson AGX xavier 风扇开机自启动设置
1. 风扇开机自启设置
切换到 root 用户
sudo su
修改风扇pwm调速文件权限
chmod 777 /sys/devices/pwm-fan/target_pwm
修改系统外设配置文件,并添加风扇开机启动任务:
vim /lib/systemd/system/rc-local.service
注意: 1.如不知道该文件路径,可以通过搜索rc-local.service来查看; 2.vim编辑器使用:进入vim编辑器后,按i键进入编辑模式,对内容进行编辑,按esc退出编辑模式,退出编辑模式情况下,输入:wq,可保存并退出vim编辑器。
修改前内容:
# SPDX-License-Identifier: LGPL-2.1+ # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # This unit gets pulled automatically into multi-user.target by # systemd-rc-local-generator if /etc/rc.local is executable. [Unit] Description=/etc/rc.local Compatibility Documentation=man:systemd-rc-local-generator(8) ConditionFileIsExecutable=/etc/rc.local After=network.target [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 RemainAfterExit=yes GuessMainPID=no
在后面添加install区块:
[Install] WantedBy=multi-user.target Alias=rc-local.service
修改后内容:
# SPDX-License-Identifier: LGPL-2.1+ # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # This unit gets pulled automatically into multi-user.target by # systemd-rc-local-generator if /etc/rc.local is executable. [Unit] Description=/etc/rc.local Compatibility Documentation=man:systemd-rc-local-generator(8) ConditionFileIsExecutable=/etc/rc.local After=network.target [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 RemainAfterExit=yes GuessMainPID=no [Install] WantedBy=multi-user.target Alias=rc-local.service
新建任务文件:
vim /etc/rc.local
添加风扇自启任务(其中echo后的值为风扇转速,范围为0-250):
#!/bin/bash -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. sleep 30 echo "200" > /sys/devices/pwm-fan/target_pwm exit 0
使rc-local服务自动启动
systemctl enable rc-local #这条语句就是创建一个超链接,在系统启动服务程序中.
给rc.local文件赋予可执行权限:
chmod +x /etc/rc.local
先执行如下命令,启动服务并检查状态
systemctl daemon-reload #重新加载 systemctl stop rc-local.service #停止rc-local.service服务 systemctl start rc-local.service #启动rc-local.service服务 systemctl status rc-local.service #检查服务状态
如果上面的命令不报错了,那说明设置成功了,然后就可以重启看下效果
2. 直接开启风扇(重启无效)
用vim编辑器修改(范围:0~250):
vim /sys/devices/pwm-fan/target_pwm
终端直接修改:
sudo sh -c "echo 150 > /sys/devices/pwm-fan/target_pwm"
第一次写博客,有不足之处请批评指出。
参考资料: https://blog..net/u013171226/article/details/107680325 http://lnmp.ailinux.net/systemctl
