acar25
Posts: 3
Joined: Sat Sep 27, 2014 2:01 am

SSH Abnormalities

Wed Dec 24, 2014 2:20 am

My friend and I are setting up a string of LEDs that are controlled by the gpio pins on our raspberry pi. We switch the colors of the LEDs by running .py scripts that change which pins are on and off.

To change the script we use an ssh client with the command "sudo python xxxxxx.oh" when xxxxxx is the color that we want which we named each py file.

Recently when we disconnect the ssh client on our smart phone the pi reverts to one the .py files.

On a related note when we run a script with a blinking effect we have to ctrl+z to exit it and run a new script. Will provide more info if needed.

User avatar
jojopi
Posts: 3268
Joined: Tue Oct 11, 2011 8:38 pm

Re: SSH Abnormalities

Wed Dec 24, 2014 7:34 am

Ctrl+Z does not normally exit a program. It stops it temporarily so you can run other commands and then continue with "fg", or put it in the background with "bg". If you suspend too many jobs like this without continuing them, you can run out of process slots or RAM. To signal that you want a script to exit completely, try Ctrl+C.

To start a script directly in the background use a trailing ampersand like "python xxx.py &". If you need it to keep running after you log out, it is best to start it inside a session of "screen" or "tmux". You can reattach this on subsequent logins.

Return to “Troubleshooting”