-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from KanoComputing/logon-session-tracker
Adding lightdm hook scripts to track user login sessions
- Loading branch information
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# ldm-session-cleanup-script | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
# | ||
# https://wiki.ubuntu.com/LightDM | ||
# | ||
# This script is called by lightm when the user logs off | ||
# We collect the time the users spent on this session and save it on the tracker | ||
# | ||
|
||
started=`cat /home/$USER/.session-started` | ||
finish=$(date +"%s") | ||
session_time=$(($finish-$started)) | ||
|
||
su - $USER -c "kano-profile-cli increment_app_runtime logon-session $session_time" | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# ldm-session-setup-script | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
# | ||
# https://wiki.ubuntu.com/LightDM | ||
# | ||
# This script is called by lightm during user logon session | ||
# We save the current time here so we can estimate usage timings | ||
# | ||
|
||
su - $USER -c "date +'%s' > ~/.session-started" | ||
|
||
# zero means proceed with login, anything else will cancel the session | ||
exit 0 |