Hi there! I'm new to Linux and I'm using Raspberry Pi OS on my Raspberry Pi. I'm looking for a way to make a script that runs a terminal command every time the OS boots up, just to simplify my workflow. The command I want to use is for the Raspberry Pi Camera module, specifically "rpicam-still -t 0". I've tried using crontab, but all the examples I found seem to deal with actual programs rather than straightforward terminal commands. I also tried editing the rc.local file to add the command, but it didn't work either. I'm really stuck and could use some guidance on what I might be doing wrong or what my next steps should be.
4 Answers
Is "rpicam" not a binary? It should run directly as a program. You might want to try piping it to bash if you're focusing on terminal execution.
Have you thought about creating a bash script for your command? You could then set it up with crontab to execute on boot. That might get around the issues you're facing.
Every terminal command is essentially a program, except for a few like `echo`. If you want to use rc.local, double-check that you've got it right and maybe use the full path for your command.
Using rc.local is getting a bit outdated for many distros now. To use it, make sure your rc.local file starts with `#!/bin/bash`, is executable, and that the rc.local service is enabled. Also, does your command need to be run as root? If it needs to run upon your user logging in, consider creating a custom .desktop file in either `.local/share/autostart` or `/etc/xdg/autostart`. You might also explore making a custom service for your command.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux