I have a bash script which is in this directory:


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


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.

  • 3
    I’m voting to close this question because it is illegal
    – joan
    Jan 5, 2021 at 21:42
  • 3
    Admitting to engaging illegal activity is not illegal, generally speaking discussing how to do something that may be illegal in the UK or the USA or China or Russia or Luxembourg or all of the above is NOT illegal. If the CIA or MI6 or FCC or whoever wants to monitor this board in order to uncover illegal activity by users, including the wanton and maniacal misuse of radio signals, that's fine, but there is nothing illegal going on here. Please see: meta.stackexchange.com/questions/358963/…
    – goldilocks
    Jan 5, 2021 at 23:18
  • Does this answer your question? Run bash script on startup Jan 7, 2021 at 9:09
  • @joan Low-power FM transmitters are legal in most parts of the world. That's how MP3 players for old cars work. Jan 7, 2021 at 9:13

2 Answers 2


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).


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.

  • I already tried and this does not work
    – wnetMC
    Jan 5, 2021 at 21:08
  • 1
    Just saying it does not work is unhelpful, why does it not work? Are there error statements? Did you try just calling a separate file and looking at its output? Did you try running rc.local manually? There's no reason for it to not work
    – Adi
    Jan 5, 2021 at 21:16
  • I am able to run rc.local but nothing pops up at startup. It is an ongoing nprocess which can't be stopped. If it works, will a terminal window pop up and run my command at startup? I don't get anything.
    – wnetMC
    Jan 6, 2021 at 1:25
  • 1
    I'm sorry, but rc.local is deprecated - it shouldn't be used unless you know how to avoid the pitfalls.
    – Seamus
    Jan 6, 2021 at 7:17
  • Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it.
    – Ingo
    Jan 6, 2021 at 9:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.