树莓派 设置开机启动项 (并托管后台自动运行)

树莓派 设置开机启动项 (并托管后台自动运行)

  1. 开机自动挂载U盘 并托管后台
  2. 开机自动cpolar穿墙 并托管后台
  3. 开机自动执行特定脚本 并托管后台
pi@mini:~ $ cat /etc/rc.local
#!/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
# 开机自动挂载U盘 并托管后台
nohup sudo mount /dev/sda1 /mnt/usb1
# 开机自动cpolar穿墙 并托管后台
nohup /home/base/cpolar start-all -config=/home/pi/.cpolar/cpolar.yml -log=stdout &
# 开机自动执行特定脚本 并托管后台
nohup bash /home/work/mplayer/mvf_b.sh -log=stdout &
exit 0

你可能感兴趣的:(树莓派,linux,linux)