-2

I have a bash script which is in this directory:

/home/pi/darkCove/radio/start.sh

It basically transmitts an FM signal. Here is the code:

#!/bin/bash

sudo ./pi_fm_rds -freq 87.5 -audio pulses.wav -ps 'DarkCove' -rt 'DarkCove FM - Crypto Prices & News' -pi 1234

I Know that this question has already been asked but I can't seem top make anything work. I need this program to run in this directory and It needs to stay open. Please answer the question and don't just say "That's illegal." I know what I'm doing and im conscious that this is illegal but please, just don't answer this question if this is what you are going to write.

wnetMC
  • 105
  • 1

2 Answers2

1

Many scripts that need to be run at startup can be started by adding it to /etc/rc.local. You can check the linux documentation to see how rc.local works. Since it requires elevated privileges, use sudo to run the command. Be careful to add a & at the end of the statement to allow startup to occur normally.

Seamus
  • 23,558
  • 5
  • 42
  • 83
Adi
  • 44
  • 4
1

You might try using root's crontab. Something like this:

$ sudo crontab

This will open an editor for root's crontab. Enter the following (or something similar) in the editor, save it, close the editor & reboot. Don't know what you mean by "It needs to stay open.", but you can edit your question if you wish to add additional details.

@reboot (sleep 30; /home/pi/darkCove/radio/start.sh) >> /home/pi/logfile.txt 2>&1

The sleep 30 command waits 30 seconds before starting your script. No idea whether this is needed or not, but you can reduce it or delete it if not needed. The redirect after calling your script is to put any stderr output in a file. Again, you may delete this if you don't want or need it.

Oh - one other thing: Make sure your script is marked as executable (chmod).

Seamus
  • 23,558
  • 5
  • 42
  • 83