Xscreensaver VPN Network Disconnect/Reconnect Script
Hi, having trouble with a script I made to disconnect/reconnect my network connection and vpn. Everything works except for the reconnection of my vpn using nmcli con up.
It behaves differently depending how it is invoked. If I use the terminal to start the script it works. But if I start the script as an /etc/xdg/autostart desktop entry it fails on reconnection of the vpn. And there is no output for me to determine what is wrong. The command alone runs fine in the terminal. (nmcli con up blah blah) But fails as part of the script. I guess it is either a permission problem or the preceding sleep statement doesnt work as intended. Cany somone help me fix this? Im very close! Code:
#!/bin/bash |
Might have a problem with the "echo NET_DOWN" as an autostart doesn't have anywhere to send it...
nit: It would make it easier to read if those long lines were broken up. No need for the && syntax either - just put them on a new line with suitable indentation. It might also make it easier to debug. |
Progress
Okay, I did this and now the nmcli commands work!
Code:
#!/bin/bash However, if I autostart it by adding this line to the end of my .bash_profile, it all works except for the dbus commands Code:
/usr/local/bin/lockedNet.sh & Code:
aubrey ALL= NOPASSWD: /usr/bin/dbus-send Regards Aubrey. |
more progress...
HI,
I tried using another command instead of the dbus commands Code:
#!/bin/bash Again it doesnt work from autostart (.bash_profile or gnome-session-properties) but it does from the terminal!! I guess I am close here if anyone knows?? Regards Aubrey. |
sudo requires a terminal for a password check... There is no terminal from autostart.
|
Solved
Yes, thats it. I had to use
Code:
!requiretty So Im thrilled now my desktop is a clam-shell now! It locks up the network when idle. Thanks! :-) Regards Aubrey. |
All times are GMT -5. The time now is 04:16 AM. |