Reply to All
Show messages
Messages
Inbox
Search
Login
1–10
11–15
Pi startup program
From: Chris (CHRISSS)
8 Feb 2016 21:00
To: ALL
1 of 15
41685.1
How do I make a program run when the Pi boots? I've tried before but not managed it properly so I'm going to attempt it again.
I just read a guide which says to edit rc.local and add a line in there with & to make it run in a separate process. No luck. Nothing happens (or seems to). If I run rc.local when I've logged in it works but my program starts spewing it's output all over the console. Not so good.
Currently what I do is login to the Pi, run screen, run my program, detach the screen and let it do whatever it wants hidden away. Is there some way I can do something similariaraly automagicamatically?
From: ANT_THOMAS
8 Feb 2016 21:04
To: Chris (CHRISSS)
2 of 15
41685.2
In reply to
41685.1
You can create an init script.
Or a very simple way is to use an @reboot line in crontab.
To prevent the output you can point it to /dev/null
Code:
@reboot /usr/local/sbin/mycommand.sh > /dev/null 2>&1
From: Chris (CHRISSS)
8 Feb 2016 21:15
To: ANT_THOMAS
3 of 15
41685.3
In reply to
41685.2
Yay! That worked. Thanks Ant
:)
Finally working.
From: ANT_THOMAS
8 Feb 2016 21:17
To: Chris (CHRISSS)
4 of 15
41685.4
In reply to
41685.3
(highfive)
From: Chris (CHRISSS)
8 Feb 2016 21:19
To: ANT_THOMAS
5 of 15
41685.5
In reply to
41685.4
It's been a pain every time we've had a powercut so this will make it so much easier. First attempt last year stopped the Pi rebooting properly for some reason.
From: ANT_THOMAS
8 Feb 2016 21:32
To: Chris (CHRISSS)
6 of 15
41685.6
In reply to
41685.5
Do you have regular power cuts?
From: Chris (CHRISSS)
8 Feb 2016 21:36
To: ANT_THOMAS
7 of 15
41685.7
In reply to
41685.6
We've had a few brief ones with all the shitty weather we've had recently. Woken up a few times with the oven clock flashing at us in the morning.
From: graphitone
9 Feb 2016 09:23
To: Chris (CHRISSS)
8 of 15
41685.8
In reply to
41685.7
Your oven's in the bedroom?
From: koswix
9 Feb 2016 10:26
To: graphitone
9 of 15
41685.9
In reply to
41685.8
Dutch oven
:C
From: graphitone
9 Feb 2016 11:44
To: koswix
10 of 15
41685.10
In reply to
41685.9
I had to look that up on Urban Dictionary.
:-$