There are two points in each of the connecting and disconnecting phases in which custom scripts can be executed through the shell. These are (under normal circumstances):
The following environment variables are set in the shell environment in which all four custom scripts are executed:
The following variables are set in the shell environment in which the connect post-script and disconnect pre-script are executed.
A sample connect pre-script:
#!/bin/sh
# WiFi Radar connection pre-script
#
if [ "$WIFIRADAR_IF" = "ra0" ]; then
iwpriv ra0 ENCMODE=$WIFIRADAR_ENCMODE
iwpriv ra0 SECURITY=$WIFIRADAR_SECMODE
fi
A sample connect post-script:
#!/bin/sh
# WiFi Radar connection post-script
#
if [ "$WIFIRADAR_PROFILE" = "WinterPalace:" ]; then
/etc/rc.d/rc.privoxy start
# update dyndns.org record
/usr/local/sbin/ddclient -i $WIFIRADAR_IP
fi
if [ "$WIFIRADAR_ESSID" = "HOME" ]; then
mount -t nfs home-nfs:/home/sean $HOME/sean/fileserver
fi
A sample disconnect post-script:
#!/bin/sh
# WiFi Radar disconnection post-script
#
if [ "$WIFIRADAR_PROFILE" = "WinterPalace:" ]; then
/etc/rc.d/rc.privoxy stop
fi
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
/bin/domainname $(cat /etc/HOSTNAME | cut -f2- -d .)