Collects recent users to determine the primary user of a device
  • Python 90.7%
  • Shell 4.8%
  • Batchfile 4.5%
Find a file
2026-10-23 09:18:58 -04:00
.gitignore Added comments, backup option for users.pkl 2026-10-19 16:01:50 -04:00
collectUsers.py Add database cleanup option, add header. Changed database backups to on by default. Updated README.md 2026-10-22 11:14:27 -04:00
exclusions Add exclusions for 5th graders 2026-10-23 09:18:58 -04:00
getAllDevices.bat Added exclusions list and Microslop Windows support. 2026-10-20 12:46:50 -04:00
getAllDevices.sh Added comments, backup option for users.pkl 2026-10-19 16:01:50 -04:00
README.md Add database cleanup option, add header. Changed database backups to on by default. Updated README.md 2026-10-22 11:14:27 -04:00

User collection for the RESD

getAllDevices.sh

This file is the actual script to be executed by a cron task. It gets the updated information, then runs collectUsers.py in the proper mode to save it. By default, it asks collectUsers.py to backup the users.pkl file. There is an equivalent getAllDevices.bat file for Windows users.

exclusions

exclusions is a basic text file containing serial numbers of Chromebooks we already have tracked properly. It has a serial number on each line. Case insensitive.

collectUsers.py

This file has a few modes depending on what we need. The file takes two command line arguments. First, the mode to execute in. Second, whether to create a backup of users.pkl on each run. File backup is on by default, so to disable, set the second argument to 'false'. With backups on, it will create a backups directory (if necessary), then save a copy file to it. The first argument (the mode) has these three options:

dataCollect

This argument is used by getAllDevices.sh. It tells the script to read from devices.csv and count the recent users, then save to users.pkl.

printData

This is more of a debug option. It just prints the wraw data from users.pkl.

cleanData

This option goes through the database and removes any devices that are in the exclusions file. Useful for if you get concrete data on some Chromebooks after you start running the script regularly.

exportPrimaryUsers

This will be used to export the most common user per device. It saves it to primaryUsers.csv and has the columns 'serial', 'user', and 'occurences'.