반응형
[2022/04/06] Add title image
[2022/03/07] Start
소나무 기운 , 전자제품 개발/생산
How to Auto Start a Program on Raspberry Pi? (rc.local)
라즈베리파이 부팅시 프로그램 자동실행.
Edit rc.local file.
sudo nano /etc/rc.local
edit rc.local file using nano-editor.
소제목 2
#!/bin/sh -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.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
sleep 10
cd /home/pi
./EXE_filename &
exit 0
slepp 10 : It can be delayed for 10 seconds.
cd /home/pi : goto /home/pi
./EXE_filename : Execute the EXE_fileneme.
& : EXE_filename allows continuous execution by itself.
프로그램이 끝날때까지 기다리지 않고 실행될수 있도록 해 놓고 빠져나온다.
How to use nano-editor
Ctrl + O : (Write Out) Save file.
Ctrl + X : Exit
If you type enter, it's saved.
마무리
/etc/rc.local
If you enter it as above, you can run it without rebooting.
위에서 처럼 입력하면 재부팅하지 않고 실행해볼수 있다.
참고문헌
![](https://blog.kakaocdn.net/dn/bAne7x/btryxzCitWP/CKRPS5cQMhIZxoPS38MF90/tfile.bmp)
틀린 부분이나 질문은 댓글 달아주세요.
즐거운 하루 보내세요. 감사합니다.
반응형
'Raspberry Pi (Linux, ubuntu)' 카테고리의 다른 글
linux, ubuntu shutdown command (0) | 2022.03.08 |
---|---|
How to use a non-blocking TCP socket. (0) | 2022.03.08 |
chmod - Replace permissions for file and folders on Linux(Raspberry Pi) (0) | 2022.03.07 |
라즈베리파이 프로세스 확인 및 제거 실행 (0) | 2021.11.19 |
[API] log 생성 구현 c코드 (0) | 2021.10.22 |
댓글