Joey Hafner
97e4cc547a
1. homelab [Gitea](https://gitea.jafner.tools/Jafner/homelab), [Github (docker_config)](https://github.com/Jafner/docker_config), [Github (wiki)](https://github.com/Jafner/wiki), [Github (cloud_tools)](https://github.com/Jafner/cloud_tools), [Github (self-hosting)](https://github.com/Jafner/self-hosting). - Rename? Jafner.net? Wouldn't that be `Jafner/Jafner.net/Jafner.net`? 2. Jafner.dev [Github](https://github.com/Jafner/Jafner.dev). 3. dotfiles [Gitea](https://gitea.jafner.tools/Jafner/dotfiles), [Github](https://github.com/Jafner/dotfiles). 4. nvgm [Gitea](https://gitea.jafner.tools/Jafner/nvgm) 5. pamidi [Gitea](https://gitea.jafner.tools/Jafner/pamidi), [Github](https://github.com/Jafner/pamidi) 6. docker-llm-amd [Gitea](https://gitea.jafner.tools/Jafner/docker-llm-amd) 7. doradash [Gitea](https://gitea.jafner.tools/Jafner/doradash) 8. clip-it-and-ship-it [Gitea (PyClipIt)](https://gitea.jafner.tools/Jafner/PyClipIt), [Github](https://github.com/Jafner/clip-it-and-ship-it). 9. razer battery led [Github](https://github.com/Jafner/Razer-BatteryLevelRGB) 10. 5etools-docker [Github](https://github.com/Jafner/5etools-docker) 11. jafner-homebrew [Github](https://github.com/Jafner/jafner-homebrew)
35 lines
1.4 KiB
Bash
35 lines
1.4 KiB
Bash
#!/bin/sh
|
|
FROM_DIR=$1 # trailing slash
|
|
TO_DIR=$2 # trailing slash
|
|
LOG_FILE=/mnt/Tank/home/admin/copy.log
|
|
|
|
rsync -avhW $FROM_DIR $TO_DIR > $LOG_FILE
|
|
|
|
# If filesize is less than 23 million bytes (21.93 MiB)
|
|
# Gives generous headroom for Gmail max attachment size
|
|
if [ $(ls -la $LOG_FILE | awk '{print $5}') -le 23000000 ]; then
|
|
( echo "Subject: Copy $FROM_DIR to $TO_DIR operation complete."
|
|
echo "Mime-Version: 1.0"
|
|
echo "Content-Type: multipart/mixed; boundary=\"d29a0c638b540b23e9a29a3a9aebc900aeeb6a82\""
|
|
echo "Content-Transfer-Encoding: 7bit"
|
|
echo ""
|
|
echo "--d29a0c638b540b23e9a29a3a9aebc900aeeb6a82"
|
|
echo "Content-Type: text/html; charset=\"UTF-8\""
|
|
echo "Content-Transfer-Encoding: 7bit"
|
|
echo "Content-Disposition: inline"
|
|
echo ""
|
|
echo "Copy $FROM_DIR to $TO_DIR complete. See log at $LOG_FILE for details about what was copied."
|
|
echo ""
|
|
echo "--d29a0c638b540b23e9a29a3a9aebc900aeeb6a82"
|
|
echo "Content-Type: text/plain"
|
|
echo "Content-Transfer-Encoding: base64"
|
|
echo "Content-Disposition: attachment; filename=\"$(basename $LOG_FILE)\""
|
|
echo ""
|
|
base64 "$LOG_FILE"
|
|
echo "--d29a0c638b540b23e9a29a3a9aebc900aeeb6a82--"
|
|
echo ""
|
|
echo "--d29a0c638b540b23e9a29a3a9aebc900aeeb6a82--"
|
|
) | sendmail root
|
|
else
|
|
echo "Filesize too large to attach. See log file at $LOG_FILE for details." | mail -s "Copy $FROM_DIR to $TO_DIR operation complete." root
|
|
fi |