0

-My problem:

I can't get autostart to work (/etc/rc.local or /etc/init.d)

/etc/rc.local screen never boots and kills the pi, which then needs to be re-flashed to work again.

/etc/init.d no auto start. Pi is still alive.

/etc/rc.local I can not ssh into the machine to delete the rc.local and holding down shift does not boot into safe mode. so I have to re-flash the .img to try again. and then fail again.

I am following goldilocks help example pifm Crash Loop my Raspberry Pi and code from http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter#Steps_to_play_sound:

#!/bin/bash
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/bin
(
  exec &>> /var/log/my_rc_local.log
  cd /home/pi/pifm && ./pifm sound.wav 90.5 
) &

exit 0

I have tried deleting: export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/bin

I have also tried different spacing with no luck

#!/bin/bash
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/bin
(
 exec &>> /var/log/my_rc_local.log
 cd /home/pi/pifm && ./pifm sound.wav 90.5 
)&

exit 0

using a /etc/init.d/file.sh

#!/bin/bash
cd /home/pi/pifm
sudo ./pifm sound.wav 90.5

then made the script executable using

sudo chmod 755 /etc/init.d/file.sh

the test worked!!!

sudo /etc/init.d/file.sh start

then registered the script

sudo update-rc.d file.sh defaults

the pi boots/starts but the file.sh is not auto started.

any ideas?

Duffman
  • 9
  • 4

1 Answers1

1

from Jaromanda X below in comments add "sleep 10" to the line before

#!/bin/bash
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/bin
sleep 10
(
  exec &>> /var/log/my_rc_local.log
  cd /home/pi/pifm && ./pifm sound.wav 90.5 
) &

exit 0
Duffman
  • 9
  • 4