Detecting if user has logged out

Hello,
I am currently using a Java proram to run as a periodic background process on a linux machine that I telnet to. I need the app to detect when I have logged out and exit. Ant ideas on how I can do this??
Cheers in advance for any help,
Shane

This post interested me and I wrote some code to see if this could be done. You would have to modify it to fit your needs, but I think this could help you. It is only class that verifies if the user "root" is logged in, it worked here when I tried it:
import java.io.*;
public class CheckLogin  {
  public CheckLogin() {
    super();
  public static void main(String arg[]) {
    try {
      Runtime rt= Runtime.getRuntime();
      Process p= rt.exec("who -q | grep root");
      try {
        int i= p.waitFor();
        if(i == 0) {
          BufferedReader br= new BufferedReader(new InputStreamReader(p.getInputStream()));
          System.out.println("User: "+ br.readLine());
        } else {
          System.out.println("Process did not ran.");
      } catch (InterruptedException iex) {
        System.err.println("Error: "+ iex.getMessage());
    } catch(IOException ioex) {
      System.err.println("Error: "+ ioex.getMessage());
}

Similar Messages

  • How to get the dates a user has logged into the portal??

    I need to know all the times and the dates a user has loggin to the portal? Do you know any way to do this? I was trying to use "successfullogoncount" from UME_STRING of the PCD database but it doesn't say anything about the dates. I also try to use "lastsuccessfulllogon" from the sama table but, as the name says, it just give me the last date of logon... Please help!!!

    Hi Pablo,
    probably you could work with Portal activity reports.
    This can generate reports on activity in the portal, either reports on how many users were logged on to the portal or reports on the most popular pages and iViews.
    look out on this weblog at
    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1242. [original link is broken] [original link is broken] [original link is broken]
    From this you can know which user has logged on at which date and time.
    If you are not looking for Portal activity reports try this:
    You can  get this information in the Visual Administrator of the J2EE Engine.
    Goto  Security Provider Service -> Runtime -> Login (Sessions).
    This would return a table showing the users along with the logging in start date&time, (if logged out) log out date&time, user-Ids, etc.
    Hope this helps,
    Regards,
    Uma.
    Message was edited by: Uma Thirugnanam

  • How to find Responsibility through which the user has logged in to Disco.

    Hi All,
    I have got a requirement to create a "Usage Report Summary by Responsibility" for all Oracle user having an Access to Oracle Disco Viewer.
    In the report, I need to show the list of Oracle Users and the Responsibilities through which an User has logged in to Disco Viewer.
    Kindly help me in finding the corresponding Disco tables to full-fill this requirement.
    Available Information/queries in my Hand:
    1. Query to find the list of Workbook and its shared Responsibilities
    2. Query to find number of times an Oracle Disco Report has been run.
    Thanks a ton in Advance
    Arun

    Hi Arun
    The first place to look is to try running one of the pre-built workbooks created by Oracle for this purpose.
    I see you are working in Apps mode. Therefore, you'll need to run both of these scripts when logged in as the owner of the EUL:
    1. EUL5.SQL
    2. EUL5_APPS.SQL
    You will find both scripts in the $ORACLE_HOME/Discoverer/Util folder where your Discoverer Administrator tool is located.
    Next, you will need to log into the Administrator tool and import this EEX file: EUL5.EEX
    You will find the EEX file located in $ORACLE_HOME/Discoverer, again on the PC where Discoverer Administrator tool is located.
    After you have imported the EUL, log into Desktop or Plus and open up the EUL5 workbook that you will now see in the list and work through the various worksheets. You should find one or two that will give you what you want.
    Let us know how you get on
    Best wishes
    Michael
    http://ascbi.com

  • Determining wether a User has Logged into an NTDomain

    Does anyone have any suggestions as to how I can determine, programmatically,
    wether a user has logged into an NT Domain, from a Win95 PC.
    From an NT workstation, I can simply check the USERNAME andUSERDOMAIN environment variables. Is there possibly a Win32 API
    call that I can make ?
    Thanks,
    -Carl
    Carl Schei
    Technical Forte Consultant
    South Africa
    +27 31 3641765 (w)
    email : [email protected]
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Does anyone have any suggestions as to how I can determine, programmatically,
    wether a user has logged into an NT Domain, from a Win95 PC.
    From an NT workstation, I can simply check the USERNAME andUSERDOMAIN environment variables. Is there possibly a Win32 API
    call that I can make ?
    Thanks,
    -Carl
    Carl Schei
    Technical Forte Consultant
    South Africa
    +27 31 3641765 (w)
    email : [email protected]
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • I have been uploading videos to Facebook with no problem.   Now get a message that the user has opted out of FB platform.  Videos will not upload.

    I have been uploading videos to FaceBook for about a month now with no problems.  Yesterday, I went to post another video and got this message "user has opted out of FaceBook Platform."  I can still post photos from this computer as well as make regular written posts.  All videos posted are 10-11 minutes in length.

    I too have noticed that once i restored from iCloud. Pictures blurry and videos wont play!
    Need help too!!

  • User gets logged out by itself

    If I leave my computer on for a while it logs my user out, or tries to.
    Often I come back and several apps have been quit out of and there is a message telling me that one of my apps stopped my user from being logged out.
    Other times it is logged out and I have to log back in and start from scratch.
    Seems similar to https://discussions.apple.com/thread/4135972?start=0&tstart=0 but I am not running multiple graphics cards and as long as I am working on the computer it has never happend. It only happens if I leave it running for a while not uning it.

    Thanks,
    I found "Log out after [60] minutes of incativity: checked under System Preferences > Security & Privacy > Advanced. I don't remember checking that but I assume that will fix my problem.

  • Detect if user is logged in

    Hi,
    several MSI applications need to be deployed to workstations in light-out
    distribution. For this, the applications are workstation associated and the
    "Distribute in Workstation Space" is enabled.
    Doing this way, the installation runs in the system contax, but how can I
    detect if there is NO user currently logged in ?
    I thought about the %USERNAME% and %NWUSERNAME" environment variables, but
    they are created in the "USER" space, thus not accessible for the system
    account.
    Any solution ?
    Many thanks in advance,
    Romain Petges

    Sorry,
    Forgot to mention that "Pre-Install" is activated.
    I already put a requirement on these variables, but the application is
    pre-installed, even with a user logged-in.... this causes big trouble
    (reboots)
    Romain
    "Craig Wilson" <[email protected]> wrote in message
    news:ggbGi.209$[email protected]..
    > Simply check for the non-existence of these variables in your app.
    >
    > NALDesk/NALWin are the programs used to deploy apps when a user is logged
    > in.
    > These will check the user space regardless of how the app is configured.
    >
    > This way your app will only distribute prior to a user logon.
    >
    >
    > --
    > Craig Wilson - MCNE, MCSE, CCNA
    > Novell Support Forums Volunteer Sysop
    >
    > Novell does not officially monitor these forums.
    >
    > Suggestions/Opinions/Statements made by me are solely my own.
    > These thoughts may not be shared by either Novell or any rational human.
    >
    > "Romain Petges" <[email protected]> wrote in message
    > news:87bGi.198$[email protected]..
    >> Hi,
    >>
    >> several MSI applications need to be deployed to workstations in light-out
    >> distribution. For this, the applications are workstation associated and
    >> the "Distribute in Workstation Space" is enabled.
    >>
    >> Doing this way, the installation runs in the system contax, but how can I
    >> detect if there is NO user currently logged in ?
    >>
    >> I thought about the %USERNAME% and %NWUSERNAME" environment variables,
    >> but they are created in the "USER" space, thus not accessible for the
    >> system account.
    >>
    >> Any solution ?
    >>
    >> Many thanks in advance,
    >> Romain Petges
    >>
    >>
    >
    >

  • Global console messages: user has logged off pts/#

    The root user and my user both get messages similar to these printed to the console:
    ashley has logged off pts/1 from dnab403c32.
    ashley has logged off pts/2 from dnab403c32.
    ashley has logged off pts/9 from dnab403c32.
    ashley has logged off pts/11 from dnab403c32.
    ashley has logged off pts/14 from dnab403c32.
    imk1 has logged on pts/11 from bio-hbf03.
    ashley has logged on pts/1 from dnab403c32.
    ashley has logged on pts/2 from dnab403c32.
    ashley has logged on pts/9 from dnab403c32.
    ashley has logged on pts/10 from dnab403c32.
    I am not sure if other users also get these messages. It isn't necessarily bad to have these messages displayed, but for some reason I cannot figure out what setting controls it. Nothing in rsyslog except emergency messages is set to print to the console. Searching the man pages and google doesn't help me much - but I might just be searching stupidly.
    Does anyone know why these messages are displayed?
    Thank you,
    Mike

    Hello,
    Try these DNS numbers.
    Try putting these numbers in Network/Advanced/DNS.
    Add these numbers to DNS Servers
    208.67.222.222
    208.67.220.220
    Click OK. These are safer/faster than most ISP's NDS numbers, and have been patched against DNS poisoning.
    Go here to test DNS. https://www.dns-oarc.net/oarc/services/dnsentropy
    Carolyn

  • Using Caching Service when the Server Sleeps or Users have logged out?

    When the Mac Mini Server logs out all users, the OS X Server 3 should still be running to my belief.  Thus the Caching Service of the OS X Server 3 should still be running.  However, in a number of cases, I found that the time taken for an app download after the first time uses the same time for download.  So, I guess the Caching Service is not performing at all when there is no Logged-in user.
    I further wonder why there is a Sleep Button at the User Log-in Screen and no wonder that the Server will not be providing Services (e.g. Caching Service) when the Server is in Sleep Mode.  Will the Server 3 be providing Caching Service while the Mac Mini Server has enter Sleep mode and it's just my configuration problem?

    Here is an explanation of how caching server works.
    http://nbalonso.com/os-x-server-caching/
    In summary:
    Your server periodically talks to apple.  Compares notes.  Verifies it is authentic.  Gets a certificate from apple to prove it is authentic.
    If your device asks for something (contacts apple), Apple says that you have a local caching server, and responds with the info telling your device to try your local server first.  (includes certificate info, so your device is confident the local server that responds is actually authorized to do so).
    If that goes well, then fine.  If not, then you device falls back to getting the info from Apple's servers.
    If your server is asleep, then this process won't work.  Your server is supposed to phone home to apple (hourly?) to keep proving it is authorized to server updates, and to update Aple's record that it is authorized to serve updates for your private network IP address.

  • Is there a way to force a file sharing user to log out?

    I have a problem: I've got a few more Macs in my office that need to connect to my computer from time to time via file sharing than OS X Snow Leopard wants to allow. I know Apple wants me to use OS X Server but I don't want to lose the simplicity of my normal workflow. Part of the problem is that users are not logged out unless they manually close the file share, which means that, say, a laptop that's asleep will still be taking up one "file sharing user slow" even though it's not needed. I can see who is logged in via the command
    set theUsers to do shell script "netstat -na | awk '/.548/ {print $5}'"
    but want I need to know is, is there any way to force, say, user 192.168.1.8.50244 off of my file share without stopping and restarting file sharing, which logs everyone out (and breaks some of my scripts on other computers.
    Any help would be appreciated.

    You could start with this hint and go from there...
    [Command Line Kung Fu #63|http://blog.commandlinekungfu.com/2009/10/episode-63-death-to-users.html]

  • How to check if the user has log in when he log in again?

    Hi all,
    I was wondering how to track if the user has already log in?
    When this user using browser A to log in then he try to log in using a new browser, then hw I am I going to know that, and terminate his session?

    Hello!
    You can try this code if you want that if a user is login at a machine and tries to login from the other, then he can continue his processing at second machine ('cos it will get the high priority) but can not process from the first machine. This code allows to login but only second one will be active.
    <jsp:useBean id="monitor1" scope="application" class="java.util.HashMap"/>
    if(monitor1.containsKey(num)){
    HttpSession oldSession = (HttpSession) monitor1.get(num);
    oldSession.invalidate();
    monitor1.remove(num);
    monitor1.put(num , session);
    But if you want to restrict it at the time of second login then u can use any of the techniques discussed above.
    aNTUMNIHA

  • Any way to have time machine when every user is logged out?

    Hello. I have a small server running os x.5 and a hard disk with Time machine attached to it. For security reasons, the best way to have it run is to have the machine run with no user logged in. Several people work on it at distance by uploading/downloading material (via SVN, SSH, and so on), but I do not want that the random passer by tinker with it (it's in a public place).
    Now, I would like it to be regularly backed up, but I discovered that Time Machine does not work if there is no user logged in. This is a drag. Do you people have any trick I could use to keep TM working even when everybody is logged out (that is, when one can only see the login window)?
    Best,
    l.

    You might find this interesting:
    http://systemsboy.blogspot.com/2008/04/time-machine-after-logout.html

  • Using struts how to check  user has logged in  and..

    In a struts form I want to check whether to user has already logged in. If
    not, instead of showing the form I want to forward the user to a login
    dialog and he must log in. After the user logged in, I want him to come back to
    the form and I have to restore the original parameters of the form.
    What is the best solution?

    Use Servlet Filter on controller servlet.

  • Web UI, users automatically logged out

    Hi
    I am facing a issue which is occurring in production system and not reproducible. We are using SAP CRM 7.0 and Users are getting logged out randomly, there is no specific pattern. Can anyone suggest something.
    I checked the settings using SMICM to set icm/keep_alive_timeout .
    Any pointers would be really appreciated.
    Thanks

    Hi,
    Check the config using the path Tcode SPRO->IMG>CRM->UI Framework->Tech Role Def->Define Tech Profile
    choose your technical profile which is assigned to your Business Role (usually Default) and click on details.
    If there is any value in field MB Memory Threshold then remove it and save.
    Compare the same in Quality and Production system.
    Regards,
    Shobhit

  • Detect if user has no camera

    Hey there,
    I'm trying to detect wether the user has a camera or not installed. In the examples I found you do this by checking if _camera = Camera.getCamera(); results in null. But when I test this on my Mac Mini (without camera) it always returns a camera object;
    Here a code snippet:
    private function setupCamera():void
                   _isMac = Boolean(Capabilities.os.substr(0,3).toLocaleLowerCase() == "mac");
                   if(_isMac)
                        var total:int = Camera.names.length;
                        var i:int;
                        for(i=0;i<total;i++)
                             Console.debug("Camera: "+Camera.getCamera(i.toString()).name);
                             switch(Camera.getCamera(i.toString()).name)
                                  case "USB Video Class Video":
                                  _camera = Camera.getCamera(i.toString());
                                  _camera = _camera?_camera:Camera.getCamera();
                                  break;
                                  default:
                                  _camera = Camera.getCamera();
                                  break
                   } else {
                        _camera = Camera.getCamera();
                if (_camera) {
                     _camera.setMotionLevel(_motionLevel);
                     _camera.setMode(_width,_height,_fps);
                    _camera.addEventListener(StatusEvent.STATUS, statusHandler);
                    _isSetup = true;
                } else {
                     _isSetup = false;
                     dispatchEvent(new Event(NO_CAMERA));
                    Console.debug("No Camera");
    Anyone any ideas?

    site.RootWeb.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser.LoginName, SPBasePermissions.Open)
    Please check the similar post here
    http://sharepoint.stackexchange.com/questions/93848/doesuserhavepermissions-problems

Maybe you are looking for