Skip to main content
in SE, questions are "solved" when an answer is upvoted or accepted; no need to use title space for it
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266

SOLVED: How do I keep track of when each user is actively using the GUI on Ubuntu?

added 854 characters in body; edited title
Source Link
Woody
  • 23
  • 5

SOLVED: How do I keep track of when each user is actively using the GUI on Ubuntu?

I have a different user for each of my own work areas on my system. This is to keep bookmarks, files and other defaults separate.

Several "users" are generally logged in at once and I just switch between them when I change which project I'm working on in that moment.

I am using Ubuntu 18.04 with Gnome Desktop Environment

I'd like to keep track of when I've been working on different projects and I figured tracking these sessions would be an easy way to do this, however I don't know if there is a log available that knows which user is using the GUI at any one time, or how to create such a tracker.

The two details I think are needed for the tracker are: 1.) Events where a user logs in, including the times when the user is unlocking a session that is already open 2.) When screen locks due to inactivity

Does anyone know if these are already/can be logged?

Thanks! Woody

Solution: ( With help from meuh below and this question: How to run a script on screen lock/unlock? )

This following script needs to be run from ~/.profile for each user that I wish to keep track of, their login/logout times all get logged in the OUTPUTFILE

The initial echo is because the script only gets run after the user has logged in and would otherwise be missed. All subsequent logins are caught from dbus-monitor

#!/bin/bash echo $(date), $USER, SCREEN_UNLOCKED >> OUTPUTFILENAME dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | while read x; do case "$x" in *"boolean true"*) echo $(date), $USER, SCREEN_LOCKED >> OUTPUTFILENAME;; *"boolean false"*) echo $(date), $USER, SCREEN_UNLOCKED >> OUTPUTFILENAME;; esac done 

How do I keep track of when each user is actively using the GUI on Ubuntu?

I have a different user for each of my own work areas on my system. This is to keep bookmarks, files and other defaults separate.

Several "users" are generally logged in at once and I just switch between them when I change which project I'm working on in that moment.

I am using Ubuntu 18.04 with Gnome Desktop Environment

I'd like to keep track of when I've been working on different projects and I figured tracking these sessions would be an easy way to do this, however I don't know if there is a log available that knows which user is using the GUI at any one time, or how to create such a tracker.

The two details I think are needed for the tracker are: 1.) Events where a user logs in, including the times when the user is unlocking a session that is already open 2.) When screen locks due to inactivity

Does anyone know if these are already/can be logged?

Thanks! Woody

SOLVED: How do I keep track of when each user is actively using the GUI on Ubuntu?

I have a different user for each of my own work areas on my system. This is to keep bookmarks, files and other defaults separate.

Several "users" are generally logged in at once and I just switch between them when I change which project I'm working on in that moment.

I am using Ubuntu 18.04 with Gnome Desktop Environment

I'd like to keep track of when I've been working on different projects and I figured tracking these sessions would be an easy way to do this, however I don't know if there is a log available that knows which user is using the GUI at any one time, or how to create such a tracker.

The two details I think are needed for the tracker are: 1.) Events where a user logs in, including the times when the user is unlocking a session that is already open 2.) When screen locks due to inactivity

Does anyone know if these are already/can be logged?

Thanks! Woody

Solution: ( With help from meuh below and this question: How to run a script on screen lock/unlock? )

This following script needs to be run from ~/.profile for each user that I wish to keep track of, their login/logout times all get logged in the OUTPUTFILE

The initial echo is because the script only gets run after the user has logged in and would otherwise be missed. All subsequent logins are caught from dbus-monitor

#!/bin/bash echo $(date), $USER, SCREEN_UNLOCKED >> OUTPUTFILENAME dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | while read x; do case "$x" in *"boolean true"*) echo $(date), $USER, SCREEN_LOCKED >> OUTPUTFILENAME;; *"boolean false"*) echo $(date), $USER, SCREEN_UNLOCKED >> OUTPUTFILENAME;; esac done 
added 334 characters in body; edited title
Source Link
Woody
  • 23
  • 5

How do I keep track of when each user is actively using the systemGUI on Ubuntu?

I have a different user for each of my own work areas on my system. This is to keep bookmarks, files and other defaults separate.

Several "users" are generally logged in at once and I just switch between them when I change which project I'm working on in that moment.

I am using Ubuntu 18.04 with Gnome Desktop Environment

I'd like to keep track of when I've been working on different projects and I figured tracking these sessions would be an easy way to do this, however I don't know if there is a log available that knows which user is activeusing the GUI at any one time, or how to create such a tracker.

The two details I think are needed for the tracker are: 1.) Events where a user logs in, including the times when the user is unlocking a session that is already open 2.) When screen locks due to inactivity

Does anyone know if these are already/can be logged?

Thanks! Woody

How do I keep track of when each user is actively using the system on Ubuntu?

I have a different user for each of my own work areas on my system. This is to keep bookmarks, files and other defaults separate.

Several "users" are generally logged in at once and I just switch between them when I change which project I'm working on in that moment.

I'd like to keep track of when I've been working on different projects and I figured tracking these sessions would be an easy way to do this, however I don't know if there is a log available that knows which user is active at any one time, or how to create such a tracker.

Thanks! Woody

How do I keep track of when each user is actively using the GUI on Ubuntu?

I have a different user for each of my own work areas on my system. This is to keep bookmarks, files and other defaults separate.

Several "users" are generally logged in at once and I just switch between them when I change which project I'm working on in that moment.

I am using Ubuntu 18.04 with Gnome Desktop Environment

I'd like to keep track of when I've been working on different projects and I figured tracking these sessions would be an easy way to do this, however I don't know if there is a log available that knows which user is using the GUI at any one time, or how to create such a tracker.

The two details I think are needed for the tracker are: 1.) Events where a user logs in, including the times when the user is unlocking a session that is already open 2.) When screen locks due to inactivity

Does anyone know if these are already/can be logged?

Thanks! Woody

Source Link
Woody
  • 23
  • 5
Loading