Running Shell Script after boot on Raspberry PI

夙愿已清 提交于 2019-12-06 01:33:03

The reason it wasn't working was because the script needed to be run as the user pi.

I changed the code in the rc.local script to this: su - pi -c "bash /home/pi/logon.sh &"

This makes the script run as the user pi and the ampersand is used to make the script run separate to the rc.local script by forking it. (http://hacktux.com/bash/ampersand)

Put this in your crontab

@reboot /path/to/script

Edit it using

#crontab -e
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!