Skip to content

Instantly share code, notes, and snippets.

@ip413
Created September 8, 2022 18:38
Show Gist options
  • Save ip413/64004dd49b58d20efdde42412b7680bd to your computer and use it in GitHub Desktop.
Save ip413/64004dd49b58d20efdde42412b7680bd to your computer and use it in GitHub Desktop.
#!/usr/bin/sh
journalctl -r -S "1 day ago" | grep "System returned from sleep state" | head -1 | awk '{print $1, $2, $3}' | {read last_wake_up; echo $(($(date --date="now" +%s) - $(date --date="$last_wake_up" +%s)))} | {read sec ; eval "echo $(date -ud "@$sec" +'$((%s/3600/24)) days %H hours %M minutes %S seconds')"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment