Rasbian run automatically after boot-up

  • Thread starter mizieahmad
  • Start date
  • #1
16
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..
 

Answers and Replies

  • #3
530
338
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 in to 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.
 
  • #4
12,023
5,677
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.
 
  • #5
530
338
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
  • #6
12,023
5,677
Yes the ampersand runs it in the background. The article said dont forget to use it otherwise the PI will be stuck in the boot sequence waiting for the command to finish running.
 

Related Threads on Rasbian run automatically after boot-up

Replies
11
Views
1K
  • Last Post
Replies
1
Views
4K
  • Last Post
Replies
3
Views
3K
Replies
1
Views
535
Replies
18
Views
848
Replies
1
Views
2K
Replies
5
Views
2K
Replies
2
Views
2K
Replies
1
Views
656
Replies
1
Views
2K
Top