2

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.)

  • 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 '15 at 15:09
9

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]
  • how is the guy supposed to input a terminal command when he doesn't have a terminal?? – john ktejik Jun 17 '16 at 23:33
  • @johnktejik, the guy can login remotely via ssh, as stated in the answer. – RobertL Aug 28 '17 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.