summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcomputer-time-limit17
1 files changed, 4 insertions, 13 deletions
diff --git a/computer-time-limit b/computer-time-limit
index 638a2d7..c27dca1 100755
--- a/computer-time-limit
+++ b/computer-time-limit
@@ -18,15 +18,7 @@ if [ -d "${dir}"'/.git' ] && [ $# -eq 0 ] && [ "$(stat -c%U "${dir}"'/.git')" =
fi
fi
-mapfile -t users < <(
- cut -d: -f1,6 /etc/passwd \
- | while IFS=':' read -r user home; do
- dir="${home}/.local/keys"
- [ -d "${dir}" ] || continue
- find "${dir}" -mindepth 1 -maxdepth 1 -type f -name '*.sec' -printf "${user}"' %p\n' \
- | head -n1
- done
-)
+. /etc/computer-time-limit.conf
sende_msg() {
curl \
@@ -107,7 +99,7 @@ is_logged_in() {
}
stop_all() {
- for key_file in "${users[@]#* }"; do
+ for key_file in "${keys[@]}"; do
sende_msg stop "${key_file}"
done
}
@@ -117,9 +109,8 @@ noch=0
ab=$(date +%s)
while true; do
- for user_and_key in "${users[@]}"; do
- user="${user_and_key%% *}"
- key="${user_and_key#* }"
+ for user in "${!keys[@]}"; do
+ key="${keys["${user}"]}"
if is_logged_in "${user}"; then
wie_lange_noch "${key}"
check_time "${user}" "${key}"