Created
October 8, 2016 11:34
-
-
Save Fusselwurm/cd37d4fbeae364328b29975a1d5ce0d8 to your computer and use it in GitHub Desktop.
Get "last online" date for all users of a Redis based NodeBB instance
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/bash | |
TEMPFILE=`tempfile` | |
for IDX in `seq 1 1000` | |
do | |
USERNAME=`redis-cli hget user:$IDX username` | |
if [[ "$USERNAME" != "" ]] | |
then | |
LASTONLINE=$((`redis-cli hget user:$IDX lastonline` / 1000)) | |
echo `date -d@$LASTONLINE -I` $USERNAME >> $TEMPFILE | |
fi | |
done | |
cat $TEMPFILE | sort | |
rm $TEMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could this be used for a plugin to show most recently online on the Users based as a tab option?