目录

1.打开风扇

2.设置开机自动生效方法一

3.设置开机自动生效方法二

3.1.修改 /sys/devices/pwm-fan/target_pwm文件权限

3.2 修改/etc/systemd/system/rc-local.service,在后面增加install区块

3.3创建并修改rc.local文件

3.4测试


1.打开风扇

英伟达的jetson xavier 或者NX打开风扇都是通过修改下面的文件实现的。

vim /sys/devices/pwm-fan/target_pwm

或者直接

sudo sh -c "echo 150 > /sys/devices/pwm-fan/target_pwm"

但是修改上述文件的时候,重启之后失效,因此可以通过设置开启自启动的方式使风扇的设置重启继续生效,下面简单说一下步骤

2.设置开机自动生效方法一

在/etc/init.d中创建shell脚本

cd /etc/init.d
vim test.sh

在脚本中输入如下内容:注意一定要有sleep 30,经过测试发现,不加sleep,开机的时候风扇是会转,但是马上就停止不转了,像是被某个东西给修改了。

#!/bin/bashsleep 30
sudo sh -c "echo 150 > /sys/devices/pwm-fan/target_pwm"exit 0

然后给脚本增加可执行权限,

chmod +750 test.sh

然后设置开机自动启动,在这里90表明一个优先级,越高表示执行的越晚

sudo update-rc.d test.sh defaults 90

然后重启进行测试。

如想移除开机启动,执行如下命令:

update-rc.d -f aitsinitwatch.sh remove

3.设置开机自动生效方法二

3.1.修改 /sys/devices/pwm-fan/target_pwm文件权限

sudo chmod 777 /sys/devices/pwm-fan/target_pwm

3.2 修改/etc/systemd/system/rc-local.service,在后面增加install区块

sudo vim /etc/systemd/system/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

配置文件解析(主要分成三个部分):

[Unit] 段: 启动顺序与依赖关系
[Service] 段: 启动行为,如何启动,启动类型
[Install] 段: 定义如何安装这个配置文件,即怎样做到开机启动

可以看出,/etc/rc.local 的启动顺序是在网络后面,但是显然它少了 Install 段,也就没有定义如何做到开机启动,所以显然这样配置是无效的。 因此我们就需要在后面帮他加上 [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

3.3创建并修改rc.local文件

sudo vim /etc/rc.local

在里面添加如下内容,注意第一行要用bash,不要用sh:

#!/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 "150" > /sys/devices/pwm-fan/target_pwmexit 0

加入系统程序中:

sudo systemctl enable rc-local   #这条语句就是创建一个超链接,在系统启动服务程序中.

给文件赋予可执行权限:

sudo chmod +x /etc/rc.local

3.4测试

先执行如下命令,启动服务并检查状态,如果修改了rc-local.service文件,则需要用sudo systemctl daemon-reload重新加载.:

sudo systemctl daemon-reload
sudo systemctl stop   rc-local.service
sudo systemctl start  rc-local.service
sudo systemctl status rc-local.service

如果上面的命令不报错了,那说明设置成功了,然后可以重启看下效果,如果上面命令报错,则需要解决bug,否则重启后不会生效:

sudo init 6         #重启命令
sudo reboot -h now  #重启命令

本文章于20210713进行了修改.

参考文献: Ubuntu18.04设置开机启动脚本__NVIDIA Jetson xavier NX设置开机启动脚本

nvidia jetson xavier打开风扇,并设置开机启动相关推荐

  1. NVIDIA AGX Xavier散热风扇开启及开机自启风扇

    Xavier散热风扇 新入手的Xavier设备发现用不了不久,就特别烫,刚开始以为是散热不好,后来才发现是散热风扇默认没有启动,下面介绍一下如开启Xavier风扇,及其风扇的自启动 1 查看及设置Xa ...

  2. NVIDIA Jetson Xavier NX nvpmodel设置

    参考这两篇说明: Jetson 系列--jetson xavier nx和nano设置工作模式设置功率 Power Management for Jetson Xavier NX and Jetson ...

  3. NVIDIA Jetson Xavier NX刷机+ROS安装+深度学习配置

    .NVIDIA Jetson Xavier NX 完整说明流程 V1.0.0 – by Holden Date : 2021-03-19 文章目录 .NVIDIA Jetson Xavier NX 完 ...

  4. NVIDIA Jetson Xavier NX使用SD镜像刷机流程

    关于NVIDIA Xavier的一些介绍 文章目录: 1 下载NVIDIA Jetson Xavier NX 的Jetpack镜像和烧录工具 1.1 下载NVIDIA Jetson Xavier NX ...

  5. 兼容NVIDIA Jetson Xavier AGX/Orin的GMSL 设计与调试

    [欢迎访问方竹科技的淘宝店铺链接地址] 定制 GMSL2 8路采集板精准适配NVIDAI Jetson Xavier AGX/Orin Devkit套件 一.设计目标 1. 支持Jetson Xavi ...

  6. (十七)NVIDIA Jetson Xavier NX——镜像烧写

    转载自:https://zhuanlan.zhihu.com/p/370701948 (十七)NVIDIA Jetson Xavier NX--镜像烧写 梦里寻梦 Future has arrived ...

  7. NVIDIA Jetson Xavier NX禁用上电自启,使用按键开关机

    NVIDIA Jetson Xavier NX禁用上电自启,使用按键开关机 文章目录 NVIDIA Jetson Xavier NX禁用上电自启,使用按键开关机 前言 一.原理 二.拓展 前言 NX默 ...

  8. NVIDIA Jetson Xavier NX入门(3)——安装miniforge和Pytorch

    1 安装miniforge 1.1 miniforge简介 conda是一个开源的包.环境管理器,可以用于在同一个机器上安装不同版本的软件包及其依赖,并能够在不同的环境之间切换.搞深度学习的应该都十分 ...

  9. NVIDIA Jetson Xavier NX 开发套件刷机教程

    开题说明,一切以官方的刷机教程为准,任何问题,只有官方可以给你最权威的解答!!! 一.下载NX开发板套件(SD Card Image) 下载链接:https://developer.nvidia.co ...

  10. 【Jetson Xavier NX】Jetson Xavier NX风扇控制

    [Jetson Xavier NX]Jetson Xavier NX风扇控制 1.安装硬件温度检测工具sensors 安装jetson-stats 1.安装硬件温度检测工具sensors sudo a ...

最新文章

  1. 利用OpenCV读取和写入视频
  2. 建站初期关键字的定位
  3. 三、前端开发-CSS
  4. (自己测试没有问题)解决git clone时报错:The requested URL returned error: 401 Unauthorized while accessing
  5. JavaScript数组合并
  6. .[算法]图论专题之最短路径
  7. 计算机信息技术专业排名,国内计算机信息技术学科强校盘点
  8. R语言-上海二手房数据分析
  9. Android手机投屏利器scrcpy
  10. c语言pwm调光实训报告心得体会,LED调光实验报告
  11. 极虎病毒:虎年第一猛毒详解
  12. 使用Vite搭建基础项目
  13. Efficientnet笔记:各个框架最适合的图像尺寸
  14. 创建Hive外部表,关联HDFS文件
  15. 专访丨兼容国内外市场的代码分析软件,鉴释科技帮助企业减少bug发生率
  16. 教你win10浏览器禁用加载项操作方法【系统天地】
  17. Ajax的异步和同步
  18. 基于Mui与H5+开发webapp的Android原生工程打包步骤(使用新版本5+SDK与Android studio)(部分内容转自dcloud官网)...
  19. 用友U8 cloud再升级,为成长型集团注入数智新力量
  20. 使double保留两位小数的多方法 java保留两位小数

热门文章

  1. matlab坐标加图例,科学网—Matlab 循环添加图例 更改图例位置 - 肖鑫的博文
  2. 浅谈NLP中的领域自适应(Domain Adaptation) 技术
  3. axio请求获取网络数据
  4. [ 成为架构师系列 ] 2. 深入理解 Cookie 与 Session ,Facade 设计模式, 分布式 Session...
  5. matlab函数表达式里分号_matlab中分号、冒号、逗号等常用标点符号的功能和用法总结...
  6. 未来智能营销时代到来,人工智能营销系统方兴未艾
  7. 移动设备支持方式-移动设备管理MDM
  8. Sqlite3实现脏读
  9. oracle同义词表不存在,Oracle同义词的使用
  10. Mysql高级-day02