create_ap

create a nat-ed wifi ap
git clone git://git.2f30.org/create_ap
Log | Files | Refs | README | LICENSE

commit 92b696efcf66301d89d553ad8a3ae75a6ad10149
parent d388c593ab2cfc86a49e6069de3914e70881aed8
Author: oblique <psyberbits@gmail.com>
Date:   Sun, 17 Aug 2014 04:22:23 +0300

handle service's stop correctly

Diffstat:
Mcreate_ap | 12+++++++++---
Mcreate_ap.service | 3+--
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/create_ap b/create_ap @@ -242,6 +242,11 @@ die() { exit 1 } +clean_exit() { + cleanup + exit 0 +} + # if the user press ctrl+c then execute die() trap "die" SIGINT @@ -525,7 +530,9 @@ fi # start access point echo "hostapd command-line interface: hostapd_cli -p $CONFDIR/hostapd_ctrl" -trap - SIGINT # reset trap + +# from now on we exit with 0 on SIGINT +trap "clean_exit" SIGINT if ! hostapd $CONFDIR/hostapd.conf; then echo -e "\nError: Failed to run hostapd, maybe a program is interfering." >&2 @@ -542,5 +549,4 @@ if ! hostapd $CONFDIR/hostapd.conf; then die fi -cleanup -exit 0 +clean_exit diff --git a/create_ap.service b/create_ap.service @@ -4,8 +4,7 @@ After=network.target [Service] Type=simple -ExecStart=/usr/bin/bash create_ap -n -g 10.0.0.1 wlan0 AccessPointSSID -ExecStop=pkill hostapd +ExecStart=/usr/bin/create_ap -n -g 10.0.0.1 wlan0 AccessPointSSID KillSignal=SIGINT Restart=on-failure RestartSec=5