Skip to content

Instantly share code, notes, and snippets.

@Fusselwurm
Created October 8, 2016 11:34
Show Gist options
  • Save Fusselwurm/cd37d4fbeae364328b29975a1d5ce0d8 to your computer and use it in GitHub Desktop.
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
#!/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
@michaelpfaff
Copy link

Could this be used for a plugin to show most recently online on the Users based as a tab option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment