開機自動執行問題 - Linux

Table of Contents

大家好,我用樹莓派做了一個行車記錄器。

我把執行的路徑寫在 /etc/rc.local 中。

只不過不管怎麼試,都必須要用ssh先登入帳號才能夠自動執行程式......

後來把rc.local 裡的路徑丟進/etc/init.d 裡面也沒辦法......

請問一下有沒有開機不需要用ssh 登入就能夠自動執行程式的辦法?

rc.local 裡面是這樣寫,後來我把它丟進init.d也是不能開機後直接執行

#!/bin/sh
(/home/pi/dash/startPY.sh) &


下面是 startPY.sh 的程式碼

#!/bin/sh
(sleep 10;DISPLAY=0:0; sudo python /home/pi/dash/dashCorder.py)&
--

All Comments

Ivy avatarIvy2017-03-29
試試看crontab? 或是直接寫一個systemd service
Thomas avatarThomas2017-04-03
rc.local有執行權限嗎
Xanthe avatarXanthe2017-04-07
rc.local是執行,不是Script
Agnes avatarAgnes2017-04-09
直接執行寫到rc.local,或是用sh去執行