Skip to main content
Key formatting and broke up wall of text
Source Link

Can disabling a service generate an exception?

RPi is configured headless and operated via ssh. Running a pythonPython script by using a service. 

The script exits via Ctl+SCtl+S which is captured by an Exception. On the Exception the script writes data to a file, closes file and Exits. The script also has an Except line that is supposed to capture any other anomaly and write, closes file and exit. 

In order to overcome the ssh connection giving a “broken pipe” msgmessage due to inactivity, I am running the script as a service which starts on boot. Problem is when I disable the service the script stops running (as expected) but since neither Ctl+SCtl+S or another exception is generated when the service is disabled no data is being written in the Exception part of the script. 

Can a service trigger some exception that can be captured by the script and be used to gracefully end the script?

Can disabling a service generate an exception

RPi is configured headless and operated via ssh. Running a python script by using a service. The script exits via Ctl+S which is captured by an Exception. On the Exception the script writes data to a file, closes file and Exits. The script also has an Except line that is supposed to capture any other anomaly and write, closes file and exit. In order to overcome the ssh connection giving “broken pipe” msg due to inactivity I am running the script as a service which starts on boot. Problem is when I disable the service the script stops running (as expected) but since neither Ctl+S or another exception is generated when the service is disabled no data is being written in the Exception part of the script. Can a service trigger some exception that can be captured by the script and be used to gracefully end the script?

Can disabling a service generate an exception?

RPi is configured headless and operated via ssh. Running a Python script by using a service. 

The script exits via Ctl+S which is captured by an Exception. On the Exception the script writes data to a file, closes file and Exits. The script also has an Except line that is supposed to capture any other anomaly and write, closes file and exit. 

In order to overcome the ssh connection giving a “broken pipe” message due to inactivity, I am running the script as a service which starts on boot. Problem is when I disable the service the script stops running (as expected) but since neither Ctl+S or another exception is generated when the service is disabled no data is being written in the Exception part of the script. 

Can a service trigger some exception that can be captured by the script and be used to gracefully end the script?

edited body
Source Link

RipRPi is configured headless and operated via ssh. Running a python script by using a service. The script exits via Ctl+S which is captured by an Exception. On the Exception the script writes data to a file, closes file and Exits. The script also has an Except line that is supposed to capture any other anomaly and write, closes file and exit. In order to overcome the ssh connection giving “broken pipe” msg due to inactivity I am running the script as a service which starts on boot. Problem is when I disable the service the script stops running (as expected) but since neither Ctl+S or another exception is generated when the service is disabled no data is being written in the Exception part of the script. Can a service trigger some exception that can be captured by the script and be used to gracefully end the script?

Rip is configured headless and operated via ssh. Running a python script by using a service. The script exits via Ctl+S which is captured by an Exception. On the Exception the script writes data to a file, closes file and Exits. The script also has an Except line that is supposed to capture any other anomaly and write, closes file and exit. In order to overcome the ssh connection giving “broken pipe” msg due to inactivity I am running the script as a service which starts on boot. Problem is when I disable the service the script stops running (as expected) but since neither Ctl+S or another exception is generated when the service is disabled no data is being written in the Exception part of the script. Can a service trigger some exception that can be captured by the script and be used to gracefully end the script?

RPi is configured headless and operated via ssh. Running a python script by using a service. The script exits via Ctl+S which is captured by an Exception. On the Exception the script writes data to a file, closes file and Exits. The script also has an Except line that is supposed to capture any other anomaly and write, closes file and exit. In order to overcome the ssh connection giving “broken pipe” msg due to inactivity I am running the script as a service which starts on boot. Problem is when I disable the service the script stops running (as expected) but since neither Ctl+S or another exception is generated when the service is disabled no data is being written in the Exception part of the script. Can a service trigger some exception that can be captured by the script and be used to gracefully end the script?

Source Link

Can disabling a service generate an exception

Rip is configured headless and operated via ssh. Running a python script by using a service. The script exits via Ctl+S which is captured by an Exception. On the Exception the script writes data to a file, closes file and Exits. The script also has an Except line that is supposed to capture any other anomaly and write, closes file and exit. In order to overcome the ssh connection giving “broken pipe” msg due to inactivity I am running the script as a service which starts on boot. Problem is when I disable the service the script stops running (as expected) but since neither Ctl+S or another exception is generated when the service is disabled no data is being written in the Exception part of the script. Can a service trigger some exception that can be captured by the script and be used to gracefully end the script?