Created
April 20, 2022 20:37
-
-
Save carpii/2acf63434fc951490bed5af1667b51db to your computer and use it in GitHub Desktop.
log 1password filesystem events, to troubleshoot it opening more than one instance
This file contains hidden or 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/sh | |
USER=`whoami` | |
LOGFILE="/home/${USER}/1password.log" | |
D=`date +"%Y/%m/%d %H:%M:%S"` | |
echo "=======================================" >> ${LOGFILE} | |
echo "${D} - LAUNCHING WATCHER" >> ${LOGFILE} | |
inotifywait -m -e close_write,moved_to,create,delete,modify --format '%:e %f' --excludei "chromium|Network changed|sqlite" ~/.config/1Password | while read -r filename; do | |
REGEXP='(Singleton[^ ]*)' | |
D=`date +"%Y/%m/%d %H:%M:%S"` | |
echo "${D} - INOTIFY - ${filename}" >> ${LOGFILE} | |
# if event involved a Singleton* file | |
if [[ "${filename}" =~ $REGEXP ]]; then | |
echo " [LS]" >> ${LOGFILE} | |
ls -l ~/.config/1Password/${BASH_REMATCH[1]} 2>/dev/null | sed -e 's/^/ /' >> ${LOGFILE} | |
# try to identify all top-level 1password processes | |
echo " [PS]" >> ${LOGFILE} | |
pgrep -a -f -l "1Password" | grep -v "zygote\|gpu-process\|Keyr\|renderer\|utility\|inotifywait" | sed -e 's/^/ /' >> ${LOGFILE} | |
echo "--------" >> ${LOGFILE} | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment