Skip to content

Instantly share code, notes, and snippets.

@chuckhoupt
chuckhoupt / mailpage.sh
Last active June 18, 2021 19:57
Bash shell script to mail a copy of a web page's HTML so it will render correctly in most native email programs (but not in web-mail).
#!/bin/bash
# Examples:
#
# mailpage.sh http://example.com chuck@habilis.net 'An Example Page'
# mailpage.sh http://example.com chuck@habilis.net 'Passworded Page' --user=john --password=xxxxx
set -eu
USAGE=$'\n'"Usage: $(basename $0) URL address subject [ wget options ]"
@chuckhoupt
chuckhoupt / archive_logs
Last active November 30, 2021 11:47
A shell script to archive web logs on DreamHost.
#!/bin/bash
# DreamHost Web Log Archiver
#
# DreamHost only stores web logs for a few days (configurable 3-30 days),
# so to maintain long term logs, an archive copy must be maintained.
#
# This script copies new gzipped http/https log files from logs/ to
# logs_archive/
#
@chuckhoupt
chuckhoupt / Backup-Recent.sh
Last active February 20, 2023 18:48
A shell script to backup a user's recently modified files to a remote server via rsync.
#!/bin/bash
set -eux
BACKUP_ACCOUNT=backupuser@backup.example.com
MAXSIZE=45000000000
# Wait for the net to come up
while [ ! $(ifconfig | grep 'status: active') ]; do