How are people logging into the servers that the menu runs on?
If they're logging on using SSH, then the login.sh script should know about the SSH_CLIENT environment variable, which you could pass to your menu.pl script; login.sh would then contain:
sudo /usr/local/bin/menu.pl --clientip $SSH_CLIENT
The --clientip variable is just an idea, but it would be trivial to parse your command line using Getopt::Long if you choose to do it this way.
There is no 'standard' way to determine the ip of the current user, because that would assume that you're always using a network connection to connect. And that doesn't have to be the case, if you would for instance login using the local console.
You may want to have a look at the man-pages for w, who and utmp (though the latter merely describes the C library for utmp). who -m may also suit your purposes.
For a more perly solution, you may want to look at the User::Utmp module. This would allow you to inspect the login records from perl. If I remember correctly, sudo provides you with the SUDO_USER environment variable which would tell you what user originally logged in, and is running the login.sh script.
|