'How can i run multiple infinite files on boot of raspberry pi?

i have a file for my discord bot which i run on boot and now i also made a react.js app and i also want this to run on boot. But when i put:

cd /home/pi/kickzraptor-site && npm run start

also in my .bashrc file, only the first one gets run because its an infinite loop i think. How can i run both on startup? Thanks! (This is the line already at the bottom of my bashrc file)

echo Running bot.py scipt...

sudo python3 /home/pi/bot.py



Solution 1:[1]

Fastest way (not recommended) is to add & at the end of the command so that the program doesn't block for further processes. sudo python3 /home/pi/bot.py &

Recommended way is to create a systemd service that runs during or after the boot is completed (depending on its configuration). This method is also good for error handling and it provides more ability on the program.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samet B.