You are not logged in.
Hey All,
Weird problem again. We're behind a cyberoam authentication server at my grad school. We are supposed to login to the cyberoam server at each login. I wrote a small script to ask the NetworkManger to handle the authentication on it's own depending on the state of the network and raise notifications of what is happening.
While the script is authenticating the login alright, it won't raise any notifications. I've tried to debug the script on the cli where it is working fine. The code follows. Any ideas on what is wrong here. [Any suggestions on improving the code are welcome too].
#!/bin/sh
STATUS="$2"
case "$STATUS" in
"up")
/usr/bin/cyberoam -lin
TEST=$(ping -c 3 www.google.com 2> /dev/null | grep [1-3]\ received)
if [[ "$TEST" != "" ]]
then
notify-send "Network Authenticated" "Logged into Cyberoam server."
else
notify-send "Network Inaccessible" "Cyberoam server not available."
fi
;;
"down")
if [[ $(nm-tool | grep State | head -n 1 | cut -f 2 -d " ") != "connected" ]]
then
/usr/bin/cyberoam -lout
notify-send "Network Aborted" "Logged out of Cyberoam server."
fi
;;
esac
exit 0
The permissions on the script are the following:
ls -l
-rwxr--r-- 1 root root 727 Aug 3 18:55 10_cyberoam.sh
The script cyberoam is a wrapper for the ugly cyberoam client. It is working fine. Like I said, authentication is occuring. No notifications are being raised however when nm-dispatcher calls the script. If I call the script manually, it works.
Last edited by Dumbledore (2011-08-03 16:14:48)
GNU/Linux: Keep your options "open".
Offline
Never mind. For documentation purposes.
The solution is to add DISPLAY=:0 in front of each notify-send command and to run this command at the start of each login:
xhost +si localuser:$(whoami)
Does anyone know which file this command can be put in to initialize it automatically?
Last edited by Dumbledore (2011-08-03 18:24:44)
GNU/Linux: Keep your options "open".
Offline
Never mind. For documentation purposes.
The solution is to add DISPLAY=:0 in front of each notify-send command and to run this command at the start of each login:
xhost +si localuser:$(whoami)
Does anyone know which file this command can be put in to initialize it automatically?
What about
/etc/rc.local
Offline
Dear whitethorn,
Thanks for the reply. I'll try with this file and post the results. Also, meanwhile, if you have a few minutes, will you please explain the rationale of how you decided to put this in /etc/rc.local?
GNU/Linux: Keep your options "open".
Offline
Nope. Didn't work. Also, I'd been using it earlier by adding it to gnome-session-properties. I am not sure if that's the most elegant solution but it works.
GNU/Linux: Keep your options "open".
Offline