linux 自動啟動 py

  • 88
  • 0
  • 2018-02-01

linux 自動啟動 py

  1. 切換到root賬戶  sudo su
  2. 修改rc.local文件  sudo nano /etc/rc.local
  3. 在exit 0 之前添加執行命令  nohup /path/to/myscript &
  4. nano ctrl +o  後按enter
  5. sudo chmod 755 /path/to/myscript

myscript 內容延遲30秒啟動

sleep 30
sudo /xxx/xxx/xxx.py

http://www.itread01.com/content/1506423484.html

http://hj1984930.github.io/linux-sleep/

需要 gui的話 for rpi

http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/auto-running-programs-gui

sudo nano /root/.config/lxsession/LXDE-pi/autostart

+上這行測試(會打開sh)
@lxterminal

+自訂script

@sudo xxxxxxxxxxx