4

I was trying to create a program that runs at start-up that takes a picture every 10 seconds (In a infinite loop) on my raspberry pi but I discovered I had made a mistake but couldn't Ctrl+C out of it. Is there a way to escape?

(I did try to go to a different workspace but login prompt wouldn't show.)

1
  • Hmm, you could try sending a SIGQUIT which is a control-plus-backslash by default (stty -a | grep quit). Otherwise, did SSH start before rc.local ?
    – thrig
    Oct 29, 2015 at 15:09

1 Answer 1

12

If you start the program from rc.local, then you cannot login to a shell and type ctrl-c to stop it. The reason is that the program was not started from the shell that you're logged into.

You will find the process ID (pid) of the program and use the kill command to send the process a signal, causing it to terminate.

For example, at a console (in a terminal window or logged in via ssh):

ps aux | grep 'the-name-of-your-progam'

The number in the second column is the pid. Use that pid to send the process a termination signal:

kill -TERM [put-your-pid-here]

A process may choose to ignore the TERM signal, so run the ps pipeline again. If you still see the same pid, then send the kill signal:

kill -KILL [put-your-pid-here]
4
  • 1
    how is the guy supposed to input a terminal command when he doesn't have a terminal??
    – john k
    Jun 17, 2016 at 23:33
  • @johnktejik, the guy can login remotely via ssh, as stated in the answer.
    – RobertL
    Aug 28, 2017 at 5:11
  • @RobertL Can't login via ssh either Aug 19 at 23:21
  • Okay check your ip b/c I was using 191.168.1.? instead of 192.... Future readers Aug 20 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .