https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/
Run a Program On Your Raspberry Pi At Startup
In this tutorial,
we show you Five Ways you can run a program
on your Raspberry Pi
at startup.
The Five methods that are available to run a program at boot are:
●rc.local
●.bashrc
●init.d tab
●systemds
●crontab
Sample Program
In the /home/pi directory,
open a file for editing:
sudo nano sample.py
And enter the following code and save it (Press CTRL+X and Enter Y).
#! /user/bin/env python
from subprocess import call
call (['espeak "Welcome to the world of Robots" 2>/dev/null'], shell=True)
Method1 : rc.local
The first method to run a program on your Raspberry Pi at startup
is to use the file rc.local.
In order to have command or program run when the Pi boots,
you can add commands to the rc.local file.
This is especially useful
if you want to power up your Pi in headless mode
(that is without a connected monitor),
and have it run a program without configuration or a manual start.
Editing rc.local
On your Pi, edit the file /etc/rc.local using the editor of your choice.
You must edit it with root permissions:
sudo nano /etc/rc.local
Add commands to execute the python program, preferably using absolute referencing of the file location
RPi AudoRun (드라마 스위치에서 (장근석 주연))
'RaspBerry PI' 카테고리의 다른 글
SD Card, USB 인식문제 (액세스 할수...., 포맷을 할수....) (1) | 2020.03.20 |
---|---|
Sensor on GPIO pins (0) | 2017.01.04 |
0.라즈베리파이 OS 설치하기 (Window10 IoT Core) (해상도 조절법) (0) | 2016.12.30 |
Use Laptop Screen for using RaspberryPI (노트북 스크린을 라즈베리파이용으로 사용하기) (0) | 2016.12.06 |
리눅스 기초 자료 (0) | 2016.08.10 |