Skip to content

Commit 52e051f

Browse files
committed
add task to fill contents of custom idle logout hook script
1 parent 4087c03 commit 52e051f

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ It is also possible to specify a default user image in case the user's `~/.face`
5757
| `dbus_cache_group_check_group`| The group to check for. | `student` |
5858
| `login_wallpaper_path` | The path to the login wallpaper to set. | `/usr/share/42/login-screen.jpg` |
5959
| `ddcci_backlight_support` | Whether to enable support for DDC/CI to allow controlling the brightness of external monitors. Should be set to `false` if you're using iMacs with T2 chips or any other *ddcci-dkms* unsupported kernel. | `true` |
60+
| `codam_web_greeter_idle_logout_hook_contents` | The contents of the custom hook script that is run after a user is logged out due to leaving a computer idle. Look at [defaults/main.yml](defaults/main.yml) for an example. | [View example](defaults/main.yml) |

defaults/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,21 @@ login_wallpaper_path: "/usr/share/42/login-screen.jpg"
2121
# Specify whether or not to add support for ddcci-backlight control on external monitors
2222
# Requires ddcci-dkms to be installed, which is not supported by iMacs with T2 chips
2323
ddcci_backlight_support: true
24+
25+
# Custom contents for the idle logout hook script
26+
codam_web_greeter_idle_logout_hook_contents: |
27+
#!/bin/bash
28+
#
29+
# This script is executed after a user has been logged out due to inactivity by the codam-web-greeter-idler.sh script.
30+
# It receives the following arguments:
31+
# $1: username of the user that was logged out
32+
# $2: idle time in milliseconds
33+
# $3: time since screen was locked in milliseconds
34+
# $4: max idle time in milliseconds
35+
#
36+
# You can use this script to perform custom actions, such as logging, notifications, coalition system integration, etc.
37+
# It can be easily customized using the Ansible codam.webgreeter role.
38+
#
39+
# Example: Log the logout event to a file
40+
# LOGFILE="/var/log/codam-web-greeter-idle-logout.log"
41+
# echo "$(date): User '$1' was logged out due to inactivity (idletime: $2 ms, time_since_lock: $3 ms, max_idle_time: $4 ms)" >> "$LOGFILE"

tasks/setup.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@
147147
exit 0
148148
fi
149149
150+
- name: Customize post-idle-logout hook script
151+
tags: [codam.webgreeter, codam.webgreeter.setup, hooks.d]
152+
become: true
153+
copy:
154+
content: "{{ codam_web_greeter_idle_logout_hook_contents }}"
155+
dest: /usr/share/codam/codam-web-greeter-idler-hook.sh
156+
owner: root
157+
group: root
158+
mode: '0500' # Do not allow others to read this script, it may contain sensitive info
159+
150160
- name: Allow rebooting from greeter
151161
tags: [codam.webgreeter, codam.webgreeter.setup]
152162
become: true

0 commit comments

Comments
 (0)