Hi all,
I am able to run a script, called hello.py without the need for a monitor as it boots into command prompt. So, using a keyboard I log in, And then type ./hello.py
Here's what I do:
Login PI
Password raspberry
Then I wait about ten seconds for the raspberrypi$ to appear then I type ./hello.py
So, my question is how can I do all this automatically, so I don't need to use a keyboard?
I want to auto login, then when the command prompt appears, type ./hello.py
Thanks in advance
Bronto
-
- Posts: 166
- Joined: Mon Sep 02, 2013 5:39 am
Re: Auto login and start a script
First do this to setup your auto login.
http://elinux.org/RPi_Debian_Auto_Login
Then edit .bashrc. Just add your command to the bottom. It will be run after login.
http://elinux.org/RPi_Debian_Auto_Login
Then edit .bashrc. Just add your command to the bottom. It will be run after login.
Code: Select all
nano ~/.bashrc
Re: Auto login and start a script
Thanks for that.
So here's where I'm at:
Made all the changes as instructed and after reboot the script which is supposed to play an audio file, doesn't.
So, I remote connected into it. Then, I simply double clicked on lax terminal and the script started to play straight away.
So, the way I need it to work is that it will log in and open that file automatically without the need for me to remote in.
Thanks for the help
So here's where I'm at:
Made all the changes as instructed and after reboot the script which is supposed to play an audio file, doesn't.
So, I remote connected into it. Then, I simply double clicked on lax terminal and the script started to play straight away.
So, the way I need it to work is that it will log in and open that file automatically without the need for me to remote in.
Thanks for the help
Re: Auto login and start a script
If you want it to run without a user logging in, you could add an init.d boot time script:
I used this as my starting point and tweaked it to use my python script instead - the changes to use your bash script will be similar.
http://www.stuffaboutcode.com/2012/06/r ... rt-up.html
I used this as my starting point and tweaked it to use my python script instead - the changes to use your bash script will be similar.
http://www.stuffaboutcode.com/2012/06/r ... rt-up.html
www.pistuffing.co.uk - Raspberry Pi and other stuffing!
Re: Auto login and start a script
The problem here though is it just doesn't run the script for me. You see if the script runs successfully it will play an audio file.
However, connecting it to a monitor it is logged into the desktop. So, I double click on the terminal and the script starts automatically. I don't end to type in ./hello.py or anything it just starts.
I just want this to happen from the get go, without me needing to log in and do anything other than turn it on.
However, connecting it to a monitor it is logged into the desktop. So, I double click on the terminal and the script starts automatically. I don't end to type in ./hello.py or anything it just starts.
I just want this to happen from the get go, without me needing to log in and do anything other than turn it on.
Re: Auto login and start a script
Check this link. It's exactly what you want to do: http://raspberrywebserver.com/serveradm ... rt-up.html
-
- Posts: 1
- Joined: Fri Jan 03, 2014 6:21 pm
Re: Auto login and start a script
This seems to have bricked my pi. On startup it now says
Cannot open /Dev/ttyl: no such file
Re spawning too fast: disabled for 5 minutes
How do I now unlock my pi again? I can't get to the start options to login.
Cannot open /Dev/ttyl: no such file
Re spawning too fast: disabled for 5 minutes
How do I now unlock my pi again? I can't get to the start options to login.
Re: Auto login and start a script
I guess it should be tty1 (number 1 instead of letter l), plus it should be /dev instead of /DevThis seems to have bricked my pi. On startup it now says
Cannot open /Dev/ttyl: no such file
Re spawning too fast: disabled for 5 minutes
How do I now unlock my pi again? I can't get to the start options to login.
Anyway you can't literally "brick" your RPi because you always have the SD card. You can mount it somewhere else and try to re-modify the files or you can simply dd a fresh image into it.
-
- Posts: 1
- Joined: Thu Feb 20, 2014 1:31 pm
Re: Auto login and start a script
Hello Everyone,
I am trying to run a python script on autostart but the script has dependencies. I tried editing rc.local with the script path but how do I add the path for the other dependencies so it works correctly.
Thanks a lot.
Raph
I am trying to run a python script on autostart but the script has dependencies. I tried editing rc.local with the script path but how do I add the path for the other dependencies so it works correctly.
Thanks a lot.
Raph
-
- Posts: 2
- Joined: Tue Oct 06, 2015 4:03 am
Re: Auto login and start a script
Hi Bronto,
I think that you are looking for this http://www.opentechguides.com/how-to/ar ... start.html
Best regards
I think that you are looking for this http://www.opentechguides.com/how-to/ar ... start.html
Best regards
Re: Auto login and start a script
Hello, what is the way for autologin in console . For CLI not GUI. I want autologin to different user than "pi" in command line console.
The file "/etc/inittab" is missing.
The file "/etc/inittab" is missing.