Last active
January 10, 2019 09:44
-
-
Save holmboe/0c4150c4bad5c386c513611e2f72912f to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# -*- coding: utf-8; mode: sh -*- | |
current_time=$(date -d 'now' +%s) | |
lid_opened=$(date -d "$(journalctl -t systemd-logind -b | grep 'Lid opened' | tail -n1 | awk '{print $1, $2, $3}')" +%s) | |
worked_hours=$(echo 'scale=2;(' $current_time - $lid_opened ')' / 3600 | bc) | |
echo 'You have worked:' $worked_hours 'hours' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment