Trying to get a simple script executed when interface wlan0 is up.
pi@cart:~ $ cat /etc/network/if-up.d/test /bin/echo "It's up" > /dev/pts/1
Raspbian 9 (Stretch)
pi@cart:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)" NAME="Raspbian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Just the command performed manually works as intended, but not when placed in a the script to be executed when the interface is up
pi@cart:~ $ /bin/echo "It's up" > /dev/pts/1 It's up pi@cart:~ $ sudo ifconfig eth0 down pi@cart:~ $ sudo ifconfig wlan0 down pi@cart:~ $ sudo ifconfig eth0 up pi@cart:~ $ sudo ifconfig wlan0 up pi@cart:~ $
Permissions have been set appropriately as well:
pi@cart:~ $ ls -al /etc/network/if-up.d/ | grep test -rwxr-xr-x 1 root root 33 Sep 20 13:10 test pi@cart:~ $
Even tried placing the script in /etc/dhcp/dhclient-enter-hooks.d/ to no avail.
Has anyone else seen this peculiar behavior?
Edit, added #!/bin/sh to the top of the executable, which made no difference to the outcome