Ubuntu 시작 프로그램1 - Jetson Orin NX FAN max PWM 설정 with 부팅

Ubuntu startup program on boot

2023-12-14

서론:


본론

1. 프로그램 등록

#!/bin/bash

# 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.

exit 0
#!/bin/bash

# ...
/usr/bin/jetson_clocks --fan

exit 0

2. 설정 및 활성화

#  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
sudo systemctl enable rc-local.service
sudo systemctl start rc-local.service

이후, 제대로 rc-local이 켜져있는지 확인
sudo systemctl status rc-local.service

종료를 원하면
sudo systemctl stop rc-local.service
sudo systemctl disable rc-local.service

3. 응용

#!/bin/bash

source /opt/ros/noetic/setup.bash
source /home/mason/catkin_ws/devel.setup.bash

export ROS_MASTER_URI="http://localhost:11311"
export ROS_HOSTNAME="localhost"

roscore & roslaunch --wait test_package test.launch

exit 0
sudo chmod +x /home/mason/test.sh
#!/bin/bash

# ...
/usr/bin/jetson_clocks --fan
/home/mason/test.sh # 혹은 sh /home/mason/test.sh

exit 0

참고 및 출처