Starting processes (via bash script?) automatically at boot?

I’m extremely new to linux programming (as a matter of fact to any OS programming, I’m more used to to-the-metal Atmel, etc. programming). A few of my other posts probably indicate this, haha.

Luckily, the application I’m trying to develop doesn’t look like it will require changing pin muxing any longer (which I still can’t quite wrap my head around) and instead I’ll just use the available i2c and UART1 and UART2 (which I know how to enable easily by editing uEnv.txt).

However, my system needs to start and then just automatically run some processes when the system boots. These are all compiled c-code. I need to run an initialization program that sets up some shared memory locations, and then start a number of processes that run concurrently using these shared memory resources and interface with the i2c and UART interfaces.

I’ve got the code figured out to do most of this, but I’m still a bit unclear on how to actually get this to run automatically at boot. Is there some way to just get a bash script to execute at boot where I can simply call my process names from there?

Any help would be greatly appreciated. Thanks.

Also, I’m using Debian, not Angstrom.

I’m extremely new to linux programming (as a matter of fact to any OS programming, I’m more used to to-the-metal Atmel, etc. programming). A few of my other posts probably indicate this, haha.

Luckily, the application I’m trying to develop doesn’t look like it will require changing pin muxing any longer (which I still can’t quite wrap my head around) and instead I’ll just use the available i2c and UART1 and UART2 (which I know how to enable easily by editing uEnv.txt).

However, my system needs to start and then just automatically run some processes when the system boots. These are all compiled c-code. I need to run an initialization program that sets up some shared memory locations, and then start a number of processes that run concurrently using these shared memory resources and interface with the i2c and UART interfaces.

I’ve got the code figured out to do most of this, but I’m still a bit unclear on how to actually get this to run automatically at boot. Is there some way to just get a bash script to execute at boot where I can simply call my process names from there?

Any help would be greatly appreciated. Thanks.

Everything you need will be done by systemd, so search google for systemd.

Regards,
John

You could use crontab to run your program on startup. Let’s say your executable program (or shell script that calls your program) is /home/debian/helloworld. In /etc/crontab, add this line to run /home/debian/helloworld as user ‘root’ after startup :

@reboot root /home/debian/helloworld

I’ll look into this as well. Thanks.

So does systemd deprecate the init.d stuff? Namely the things described here:

https://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian

So does systemd deprecate the init.d stuff? Namely the things described here:

https://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian

Yes. Most of the main Linux distributions are migrating to systemd which replaces the old SysV init. Systemd has the benefit of starting drivers/services in parallel based on dependencies and that is why it boots much faster than SysV init.

https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet

Regards,
John

Thanks for the information, I’ll be looking into it deeper tomorrow. I suppose I could use it to launch my actual compiled processes directly, but I need to assure that a one-shot initialization process runs first to setup the POSIX shared memory regions, so I think using systemd to execute a bash script that sequences that correctly would be the way to go.

Now to wrap my head around getting GPIO working for some LEDs (and maybe some PWMs though I’d prefer to use I2C to a pwm ic for that) and I think I have something going.