Whereis404
Posts: 5
Joined: Fri Apr 17, 2015 6:51 pm

Can't exit out of a script

Fri Apr 17, 2015 9:23 pm

I started a script that starts at bootup, simple script, but the contents run in an infinite loop.

I thought I could use ctrl+c to stop it... I was wrong

Right now I can't exit that script, so I can't access the terminal. Anything I should do?

klricks
Posts: 7172
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Can't exit out of a script

Sat Apr 18, 2015 2:27 am

try Ctrl-Alt-F2
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Whereis404
Posts: 5
Joined: Fri Apr 17, 2015 6:51 pm

Re: Can't exit out of a script

Sat Apr 18, 2015 3:14 am

klricks wrote:try Ctrl-Alt-F2
Did that, what is that suppose to do? I just see the cursor flashing on the screen now.

klricks
Posts: 7172
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Can't exit out of a script

Sat Apr 18, 2015 4:25 am

Whereis404 wrote:
klricks wrote:try Ctrl-Alt-F2
Did that, what is that suppose to do? I just see the cursor flashing on the screen now.
It should give you a login prompt then console after login.

If that does not work then you can put the SD card in a Linux computer and edit / fix your script from there.
If you don't have a Linux computer you can obtain a Linux 'Live' CD and temporarily boot a Windows computer to Linux.
-OR-
Make a working SD card and attach a SD cardreader to the RPi. Then put the broken card in the SD reader and edit your file.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Can't exit out of a script

Sat Apr 18, 2015 4:43 am

Did you put your script in the "/etc/rc.local" file?

If so, you've just discovered why using /etc/rc.local is a bad idea. Because it is easy to lock up your machine by using it incorrectly.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Re: Can't exit out of a script

Sat Apr 18, 2015 5:29 am

klricks wrote:
Whereis404 wrote:
klricks wrote:try Ctrl-Alt-F2
Did that, what is that suppose to do? I just see the cursor flashing on the screen now.
It should give you a login prompt then console after login.
All the logins on the virtual consoles are started up AFTER rc.local has finished executing. If the OP's script never
finishes, and it hasn't been put into the background ( using "&" ), then the logins will never start up...

rc.local should only be used with great care !

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Whereis404
Posts: 5
Joined: Fri Apr 17, 2015 6:51 pm

Re: Can't exit out of a script

Mon Apr 20, 2015 3:12 pm

Thanks for the info
I never knew that doing it that way will lock up the computer before.

I'll be adding a break to my program now. I didn't add the & to my script as it is suppose to run in the foreground.

Right now I am going through the file structure to get my program, though I can't seem to find it in /home/pi/Documents/...

User avatar
RaTTuS
Posts: 10563
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Can't exit out of a script

Mon Apr 20, 2015 3:28 pm

How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Whereis404
Posts: 5
Joined: Fri Apr 17, 2015 6:51 pm

Re: Can't exit out of a script

Thu Apr 23, 2015 3:53 am

Thanks everyone

I fixed it by putting a linux box on my computer and going into the file system and then editing the script to have a break point out of the loop.

I will be more weary next time

Return to “Troubleshooting”