I need a way to run a script when a successful wireless connection is made.
I'm using Lubuntu 16.04 (although I've attempted this on Lubuntu and Ubuntu 18.04 with no success.)
My script is pretty simple:
Whenever computer A starts up and successfully connects to the wireless network, I require the script to run, which VNC's to computer B.
I've added this script to /etc/network/if-up.d with sudo cp, thereafter I made it executable with sudo chmod +x, and made root the owner with sudo chown root.
This script runs fine if I execute it from the terminal or manually execute it.
When I connect the PC to the network, my syslog states:
nm-dispatcher: req:1 'up' [enp3s0]: new request (1 scripts)
nm-dispatcher: req:1 'up' [enp3s0]: start running ordered scripts...
nm-dispatcher[3298]: Error: Can't open display:
nm-dispatcher[3298]: run-parts: /etc/network/if-up.d/vnc exited with return code 1
I'm unsure where I'm going wrong or perhaps if I'm doing this completely the wrong way, since being new to Linux.
I'm open to using other applications or distros if it would help me at this point.
Any assistance or ideas welcome.
I'm using Lubuntu 16.04 (although I've attempted this on Lubuntu and Ubuntu 18.04 with no success.)
My script is pretty simple:
Code:
#!/bin/bash
xtightvncviewer 192.168.0.10
Whenever computer A starts up and successfully connects to the wireless network, I require the script to run, which VNC's to computer B.
I've added this script to /etc/network/if-up.d with sudo cp, thereafter I made it executable with sudo chmod +x, and made root the owner with sudo chown root.
This script runs fine if I execute it from the terminal or manually execute it.
When I connect the PC to the network, my syslog states:
nm-dispatcher: req:1 'up' [enp3s0]: new request (1 scripts)
nm-dispatcher: req:1 'up' [enp3s0]: start running ordered scripts...
nm-dispatcher[3298]: Error: Can't open display:
nm-dispatcher[3298]: run-parts: /etc/network/if-up.d/vnc exited with return code 1
I'm unsure where I'm going wrong or perhaps if I'm doing this completely the wrong way, since being new to Linux.
I'm open to using other applications or distros if it would help me at this point.
Any assistance or ideas welcome.