Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sigterm handler isn't getting called #12

Open
gcs278 opened this issue Jul 16, 2020 · 1 comment
Open

sigterm handler isn't getting called #12

gcs278 opened this issue Jul 16, 2020 · 1 comment

Comments

@gcs278
Copy link

gcs278 commented Jul 16, 2020

I've been playing around with this addon and it appears term_handle isn't getting called. For me, I'm trying to revert from a Wireless AP back to normal Wireless Client settings, so I need the sigterm to get called. I've put echo "test" >> /data/log.txt and the file isn't getting created when I hit "stop" on the addon.

I'm willing to try to fix it, but any thoughts on why it isn't calling the sigterm handler? Do you think it's because I lose networking right as I hit the "stop" button on the supervisor? (I'm connected directly the WiFi AP to bring up the web interface)

Any help is appreciated.

@gcs278
Copy link
Author

gcs278 commented Jul 16, 2020

Okay so the sigterm handler still isn't getting called, but I've been reading up on S6 and the kill process, which is new to me.

In the meantime, I dropped this in kill.sh COPY in the dockerfile:

COPY kill.sh /etc/cont-finish.d/
RUN chmod a+x /etc/cont-finish.d/kill.sh

My kill.sh

#!/bin/bash
echo "Stopping...$(date)" >> /data/log.txt
ifdown wlan0
ip link set wlan0 down
ip addr flush dev wlan0
nmcli dev set wlan0 managed yes
exit 0

I added the nmcli dev set wlan0 managed yes as I think it is required. Now I can successfully switch back and forth between client and AP. Will put up a PR once I polish this logic up. Not sure about the maintainability of dropping stuff in /etc/cont-finish.d/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant