diff --git a/README.md b/README.md index 10dc666..e7ae8f0 100644 --- a/README.md +++ b/README.md @@ -106,10 +106,13 @@ If you only have two NICs, you can buy this cheap USB 100Mbps NIC [from Amazon]( **NOTE:** If you have the 5268AC, you'll also need to install `pfatt-5268.sh` due to [issue #5](https://github.com/aus/pfatt/issues/5). The script monitors your connection and disables or enables the EAP bridging as needed. It's a hacky workaround, but it enables you to keep your 5268AC connected, avoid EAP-Logoffs and survive reboots. Consider changing the `PING_HOST` in `pfatt-5268AC.sh` to a reliable host. Then perform these additional steps to install: - Copy `bin/pfatt-5268AC.sh` to `/usr/local/etc/rc.d/`: + Copy `bin/pfatt-5268AC` to `/usr/local/etc/rc.d/` + + Copy `bin/pfatt-5268AC.sh` to `/root/bin/`: ``` - scp bin/pfatt-5268AC.sh root@pfsense:/usr/local/etc/rc.d/ - ssh root@pfsense chmod +x /usr/local/etc/rc.d/pfatt-5268AC.sh + scp bin/pfatt-5268AC root@pfsense:/usr/local/etc/rc.d/ + scp bin/pfatt-5268AC.sh root@pfsense:/root/bin/ + ssh root@pfsense chmod +x /usr/local/etc/rc.d/pfatt-5268AC.sh /root/bin/pfatt-5268AC ``` 4. Connect cables: diff --git a/bin/pfatt-5268AC b/bin/pfatt-5268AC new file mode 100644 index 0000000..583f7cb --- /dev/null +++ b/bin/pfatt-5268AC @@ -0,0 +1,50 @@ +#!/bin/sh + +script_path="/root/bin/pfatt-5268AC.sh" + +name=`/usr/bin/basename "${script_path}"` + +rc_start() { + ### Lock out other start signals until we are done + /usr/bin/touch /var/run/${name}.lck + + ${script_path} & + pid=$! + + if [ $pid ]; then + echo $pid > /var/run/${name}.pid + /usr/bin/logger -p daemon.info -i -t pfattStartup "Successfully started ${name}" + else + /usr/bin/logger -p daemon.error -i -t pfattStartup "Error starting ${name}" + fi + + ### Remove the lock + if [ -f /var/run/${name}.lck ]; then + /bin/sleep 2 + /bin/rm /var/run/${name}.lck + fi +} + +rc_stop() { + if [ -f /var/run/${name}.pid ]; then + kill -9 `cat /var/run/${name}.pid` + /bin/rm /var/run/${name}.pid + fi +} + +case $1 in + start) + if [ ! -f /var/run/${name}.lck ]; then + rc_start + fi + ;; + stop) + rc_stop + ;; + restart) + if [ ! -f /var/run/${name}.lck ]; then + rc_stop + rc_start + fi + ;; +esac