Page 1 of 1
Raspberry Pi program launcher
Posted: Sun Dec 21, 2025 3:41 pm
by RGV250
Hi,
I thought about putting it under feature request but I am a long way off needing it.
I have several rather small Raspberry Pi programs that I would like to run from a single Pi.
I think it is only possible to run one program from editing the rc.local or bashrc file.
I could probably put all the code in on program but that would get messy.
I then wondered if it is possible to have a FC chart that calls other programs so the one program is started as normal but that one runs the others.
It would probably only need to run once on boot and then close as the other programs should be running then.
Regards,
Bob
Re: Raspberry Pi program launcher
Posted: Sun Dec 21, 2025 3:44 pm
by mnfisher
Hi Bob,
You can run multiple programs by ending the line with '&'
For example
Prog1&
Prog2&
Prog 3&
Would run all three programs...
Martin
Re: Raspberry Pi program launcher
Posted: Sun Dec 21, 2025 5:44 pm
by RGV250
Thanks Martin,
I assume that is a Linux thing.
And the last program ends with & exit 0 as normal.
Regards,
Bob
Re: Raspberry Pi program launcher
Posted: Sun Dec 21, 2025 5:53 pm
by mnfisher
Yes - a Linux (or origianally Unix) thing.
Normally - prog1 (for example) would run prog1 and wait for it to finish. The & runs it and returns immediately (so the program runs as a background task) - I think ps -al shows you all the tasks running ( or you can use top)
If you get the task id (using ps) - then you can kill background tasks using kill -9 task_id)
Martin
Re: Raspberry Pi program launcher
Posted: Sun Dec 21, 2025 7:34 pm
by RGV250
Hi,
I think I will need to do a bit of reading in the pub sometime. Years ago (before windows) I knew a lot of the DOS commands but Windows has made us lazy. It wouldn't be so bad if it worked all the time.
Bob
Re: Raspberry Pi program launcher
Posted: Mon Dec 22, 2025 5:41 am
by chipfryer27
Hi
Far from a "guru" but wouldn't adding to .bashrc not cause them to run every time you logged in meaning the potential for multiple instances? I think I remember something about this on the RPi forum.
I'm assuming you are "headless", referring to FC code rather than "downloaded apps" so to speak, and want them all to automatically run at boot?
With the intro of "systemd" it makes things a bit more stable as it allows the OS to be fully operational before running your codes which may be better than editing rc.local
If you do a search along the lines of "running multiple programs at boot on RPi using systemd" you should get some ideas. Remember permissions too, they catch me out more times than I'll admit to....
Regards
Re: Raspberry Pi program launcher
Posted: Mon Dec 22, 2025 10:51 am
by LeighM
Another possibility is using crontab @reboot (with a sleep)