Skip to content
Discussion options

You must be logged in to vote

and here is my bash script I use to determine the seconds since last access:

lastCopypartyLog=$(journalctl -u copyparty.service -b -o short-unix | grep "PFIND" --invert-match | tail -1)
tmpArr=($lastCopypartyLog)
lastCopypartyLogTimestamp=${tmpArr[0]}
# use parameter expansion to remove ms after period, use arithmetic expansion operator for adding
secondsSinceLastCopypartyAccess=$(( $(date +%s) - ${lastCopypartyLogTimestamp%.*} ))
echo seconds since last access on copyparty: $secondsSinceLastCopypartyAccess

I'm sure you can figure out how to do a shutdown from there

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@meekah7
Comment options

Answer selected by meekah7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant