Rasbian run automatically after boot-up

  • Thread starter Thread starter mizieahmad
  • Start date Start date
AI Thread Summary
The discussion focuses on automating the startup of a Python script on a Raspberry Pi 3 running Raspbian for a camera surveillance project. Users suggest two primary methods for achieving this: using the cron command to schedule tasks or editing the rc.local file to run commands at boot. The rc.local method is highlighted for its convenience, especially for headless setups, allowing the Pi to run programs without manual intervention. Participants emphasize the importance of running commands in the background using the ampersand (&) to prevent the boot process from hanging. Additionally, the "@reboot" option in cron is mentioned as a useful approach for executing tasks at startup, expanding the options available for automation.
mizieahmad
Messages
15
Reaction score
1
hello my friends, i need our help to explain to my. i am in project camera surveillance using raspberry pi 3 and i using rasbian. so the problem is every time i startup, i need to open the phyton and run them. i want to know if possible to run the file automatically after boot like bare metal..
 
Technology news on Phys.org
Look at the cron command in Linux. It allows you to setup tasks to run at set times.

https://www.raspberrypi.org/documentation/linux/usage/cron.md
 
  • Like
Likes berkeman
cron is one way. The other way, that I was somewhat familiar with from Ubuntu is editing the rc.local file. Similar structure in Raspberian:

https://www.raspberrypi.org/documentation/linux/usage/rc-local.md

In order to have a command or program run when the Pi boots, you can add commands to the rc.local file. This is especially useful if you want to be able to plug your Pi into power headless, and have it run a program without configuration or a manual start.

An alternative for scheduled task management is cron.

see link for more.
 
Yes that looks like a good solution too with the caveat that you must do what the directions say ie:
- running the command in the background

or else the Pi won't complete the boot process.
 
jedishrfu said:
Yes that looks like a good solution too with the caveat that you must do what the directions say ie:
- running the command in the background

or else the Pi won't complete the boot process.

I thought the "&" option took care of that?

The ampersand allows the command to run in a separate process and continue booting with the process running.

Either way, I learned something - I wasn't aware of the "@reboot" approach to have cron run something at boot up, I had only ever used the time functions.
 
  • Like
Likes jedishrfu
Yes the ampersand runs it in the background. The article said don't forget to use it otherwise the PI will be stuck in the boot sequence waiting for the command to finish running.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...

Similar threads

Back
Top