Commit 39445c5
xxwhirlpool
·
2026-07-04 13:11:32 -0400 EDT
parent 9b8579d
add my jank script to back up personal IRC logs
1 files changed,
+30,
-0
+30,
-0
| ... | ... | @@ -0,0 +1,30 @@ | |
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | # | |
| 3 | + | # get IRC logs from my network, back them up, & import | |
| 4 | + | # into personal DB for safekeeping | |
| 5 | + | ||
| 6 | + | # vars for file names/paths | |
| 7 | + | irchistpath="$HOME/.irc_history/logs" | |
| 8 | + | irchistbasepath="$HOME/.irc_history" | |
| 9 | + | irctargz="irc_history.tar.gz" | |
| 10 | + | ||
| 11 | + | # get logs only if `pass` is available to give soju pw | |
| 12 | + | # otherwise die | |
| 13 | + | if [[ "$(command -v pass)" ]]; then | |
| 14 | + | pass show "social/soju" | chathistorysync kat@chat.4-walls.net "$irchistpath" | |
| 15 | + | else | |
| 16 | + | echo "chat sync failed" && exit 1 | |
| 17 | + | fi | |
| 18 | + | ||
| 19 | + | # add dates next to timestamps in logs without them | |
| 20 | + | perl "$irchistpath/dates2logs.pl" | |
| 21 | + | ||
| 22 | + | # zip up the logs | |
| 23 | + | tar -C "$irchistpath" -czvf "$irchistbasepath/$irctargz" . | |
| 24 | + | ||
| 25 | + | # copy the archive to server | |
| 26 | + | rsync -avzp "$irctargz" kat@athena:/home/kat/backups | |
| 27 | + | ||
| 28 | + | # SSH into athena machine & run import script | |
| 29 | + | # this updates the local LAN only DB | |
| 30 | + | ssh athena "cd catirc && ./import_logs.sh" |