Automation scripts¶
These small scripts keep each control computer in sync. They pull the latest protocols from GitHub every morning, push behavior data to the lab NAS every night, and update BpodAcademy and the DataJoint database.
All paths assume the user ratacad1 with everything under ~/ratacad/. Edit them to
match your machine.
Schedule¶
| Time | Script | What it does |
|---|---|---|
| 01:00 | transferBpodData |
rsync Bpod Local/Data → NAS RATACAD_DATA; (Ubuntu) delete local files older than 30 days |
| 08:00 | updateProtocols |
git pull the protocols repo, then mirror Protocols/ into Bpod Local/Protocols |
| as needed | updateBpodAcademy |
reinstall BpodAcademy from GitHub into the bpod conda env |
| as needed / cron on the DB host | updateDJ |
reinstall dj_ratacad and run dj-ratacad update to ingest new sessions |
Ubuntu¶
| File | Download |
|---|---|
updateProtocols.sh |
download |
transferBpodData.sh |
download |
updateBpodAcademy.sh |
download |
updateDJ.sh |
download |
################################################
# bash script to update Bpod protocols directory
# from ScottLabBpodProtocols github
################################################
# navigate to ScottLabBpodProtocols directory
cd ~/ratacad/ScottLabBpodProtocols
# pull latest changes from master branch
#### uses SSH keys for github username = gkane26
git pull origin master
# sync ScottLabBpodProtocols/Protocols with local Bpod Protocols directory
rsync -avuz ~/ratacad/ScottLabBpodProtocols/Protocols ~/ratacad/Bpod\ Local/ --delete-after
transferBpodData.sh deletes local data
After copying, it deletes local data files older than 30 days
(find ... -mtime +30 -delete). Check that the NAS copy is working
before you enable it. The find path is relative, so it relies on cron running
from the home directory (cron's default).
Windows¶
On Windows each .sh file is run by Cygwin through a matching .bat launcher,
which is what Task Scheduler calls.
| Script | .sh |
.bat |
|---|---|---|
| updateProtocols | download | download |
| transferBpodData | download | download |
| transferMiniscopeData (optional, for miniscope rigs) | download | download |