知識社群登入
Rasp Pi 一開機就會自動執行程式
by 艾鍗學院, 2014-09-10 12:48, 人氣(2326)
Rasp Pi: Run a script on start up


$ sudo nano /etc/rc.local

把你要的啓動的程式加在這裡
若有多個同時要跑, 每個命令 加 & 背景執行
若要一開機就掛載Driver Module , insmod  xxx.ko

---------------


#!/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

exit 0