--- /dev/null
+#!/bin/sh
+
+if [ "$#" -eq "0" ]
+then
+ echo "Usage: $0 backup_directory"
+ exit 1
+fi
+
+BAKDIR=$1
+
+cd ${BAKDIR}
+
+echo CHECKING ${BAKDIR}:
+ls -l
+
+ls -1 *.md5 | while read sumfile
+do
+ echo
+ echo ${sumfile}:
+ cat ${sumfile}
+ echo
+ # /sbin/md5 -r $(cat ${sumfile} | cut -f2 -d"*") | sed "s/ / */g" | diff - ${sumfile}
+ md5sum -c ${sumfile}
+ echo MD5SUM return value: $?
+done
--- /dev/null
+#!/bin/sh
+
+if [ "$#" -eq "0" ]
+then
+ echo "Usage: $0 backup_directory"
+ exit -1
+fi
+
+BAKDIR=$1
+
+cd ${BAKDIR}
+
+echo CHECKING ${BAKDIR}:
+ls -l
+
+ls -1 *.md5 | while read sumfile
+do
+ echo
+ echo ${sumfile}:
+ cat ${sumfile}
+ echo
+ /sbin/md5 -r $(cat ${sumfile} | cut -f2 -d"*") | sed "s/ / */g" | diff - ${sumfile}
+ echo Diff return value: $?
+done
--- /dev/null
+# PLACEHOLDER FILE!
+# This script is not yet ready for publication, as it contains environment-specific and/or hard-coded sensitive data.
+# This file is here to annoy myself to make an update.
+# ~ MegaBrutal
--- /dev/null
+# PLACEHOLDER FILE!
+# This script is not yet ready for publication, as it contains environment-specific and/or hard-coded sensitive data.
+# This file is here to annoy myself to make an update.
+# ~ MegaBrutal
--- /dev/null
+#!/bin/sh
+mount /btrfs
+/sbin/btrfs subvolume snapshot -r /btrfs/@ /btrfs/@-snapshot-$(date +%Y%m%d%H%M%S)
+umount /btrfs
--- /dev/null
+#!/bin/sh
+
+if [ $# -lt 2 ]
+then
+ echo "Usage: $0 <fs> <percentage> [email]"
+ echo "Where"
+ echo " fs - file system to check"
+ echo " percentage - acceptable file system usage treshold"
+ echo " email - send warning to specified e-mail address (print to stdout, if omitted)"
+ echo "Example: $0 / 95 admin@cutekittens.tld"
+ exit
+fi
+
+if [ $(df -m $1 | sed 1d | awk '{print $5}' | sed "s/%//") -ge $2 ]
+then
+ subject="WARNING! File system usage ($1) on $(hostname) is higher than $2 percent!"
+ if [ -z "$3" ]
+ then
+ echo ${subject}
+ df -m
+ else
+ df -m | mail -s "${subject}" $3
+ fi
+fi
--- /dev/null
+#!/bin/sh
+echo SYSTEM INFO:
+uname -a
+echo
+echo SYSTEM UPTIME:
+uptime
+echo
+echo
+echo MEMORY:
+echo
+grep -E "MemTotal|MemFree|SwapTotal|SwapFree" /proc/meminfo
+echo
+echo
+echo UPDATES:
+/usr/lib/update-notifier/update-motd-updates-available --force
+/usr/lib/update-notifier/update-motd-reboot-required
+echo
+echo
+echo FILE SYSTEMS:
+echo
+df -m
+echo
+echo
+echo BTRFS SUBVOLUMES:
+echo
+/sbin/btrfs subvolume list /
+echo
+echo
+echo LXC CONTAINERS:
+echo
+lxc-ls --fancy
+echo
+echo
+echo LIBVIRT VIRTUAL MACHINES:
+echo
+virsh list
--- /dev/null
+#!/bin/sh
+passfile=$1
+cfgfile=$(readlink -f $2)
+stordir=$(readlink -f $3)
+tempdir=/tmp/mysqlbak_$$
+currdat=$(date +%Y%m%d)
+archive=$(hostname -s)
+tarname=mysqlbak_${archive}_${currdat}
+
+case $(uname) in
+ FreeBSD) statres=$(stat -f %Sp/%Su ${passfile});;
+ Linux) statres=$(stat -c %A/%U ${passfile});;
+ *) echo Unknown OS.; exit 1;;
+esac
+
+if [ "${statres}" != "-r--------/$(whoami)" ]
+then
+ echo "Password file must have 400 permissions and must be owned by you! (And it must exist, by the way.)"
+ exit 1
+fi
+dbpass=$(cat ${passfile})
+
+umask 027
+mkdir ${tempdir}
+cd ${tempdir}
+cat ${cfgfile} | while read db
+do
+ sqlfile=mysqlbak_${db}_${currdat}.sql
+ if ! mysqldump --user root --password=${dbpass} --databases ${db} > ${sqlfile};
+ then
+ echo "Failed to dump ${db} to ${sqlfile}."
+ rm ${sqlfile}
+ fi
+done
+
+if tar cvf ${tarname}.tar *.sql;
+then
+ rm *.sql
+ bzip2 --best *.tar
+ mv ${tarname}.tar.bz2 ${stordir}
+
+ cd ${stordir}
+ rmdir ${tempdir}
+
+ shift 3
+ for target in "$@"
+ do
+ scp ${tarname}.tar.bz2 ${target}
+ done
+else
+ echo "Failed to create archive: ${tarname}."
+ exit 1
+fi
--- /dev/null
+#!/bin/sh
+# By MegaBrutal
+#
+# Changelog:
+# 2014-09-13: Changed bzip2 test to tar tvf
+# 2014-01-03: Last known modification before changelog
+
+if [ "$#" -eq "0" ]
+then
+ echo "Usage: $0 list of backup directories"
+ echo "E.g.: $0 vps1 vps2 vps3"
+ exit 1
+fi
+
+CURRDAT=$(date +%Y%m%d)
+
+echo SYSTEM INFO:
+uname -a
+echo
+echo SYSTEM UPTIME:
+uptime
+echo
+echo
+echo
+
+while [ "$1" ]
+do
+ BAKDIR=$1
+ echo CHECKING ${BAKDIR}:
+ echo
+ echo "Checking for today's backup:"
+ if ls -l ${BAKDIR}/*${CURRDAT}*
+ then
+ echo
+ echo "Checking contents & consistency:"
+ if tar tvf ${BAKDIR}/*${CURRDAT}* 2>&1
+ then
+ echo
+ echo 'Today'\''s backup has successfully arrived.'
+ else
+ echo 'TODAY'\''S BACKUP IS PRESENT BUT DAMAGED! MOST LIKELY IT IS ONLY PARTIALLY TRANSFERRED!'
+ echo 'PLEASE RETRANSFER!'
+ fi
+ else
+ echo 'TODAY'\''S BACKUP IS NOT PRESENT!!!'
+ echo 'PROBABLY IT HASN'\''T BEEN TRANSFERRED DUE TO NETWORK PROBLEMS OR IT HAS NEVER BEEN MADE AT ALL!'
+ echo 'PLEASE CHECK SOURCE LOCATION!'
+ fi
+ echo
+ echo
+ echo "Other backup files present (most recent at top):"
+ ls -lt ${BAKDIR}/*
+ echo
+ echo
+ echo
+ shift
+done
--- /dev/null
+#!/bin/sh
+
+if [ $# -lt 4 ]
+then
+ echo "Usage: $0 <SMF database> <table prefix> <DB user> <password file>"
+ exit
+fi
+
+dbname=$1
+dbpref=$2
+dbuser=$3
+dbpass=$4
+
+if [ "$(stat -c %A/%U ${dbpass})" != "-r--------/$(whoami)" ]
+then
+ echo "Password file must have 400 permissions and must be owned by you! (And it must exist, by the way.)"
+ exit
+fi
+
+mysqlargs="--user=${dbuser} --password=$(cat ${dbpass}) --database=${dbname} --default-character-set=utf8 --table"
+
+echo SYSTEM INFO:
+uname -a
+echo
+echo SYSTEM UPTIME:
+uptime
+echo
+echo MYSQL VERSION:
+/usr/sbin/mysqld --version
+echo
+echo DATABASE NAME:
+echo ${dbname}
+echo
+echo
+echo Users awaiting approval:
+echo
+mysql ${mysqlargs} --execute="SELECT id_member, member_name, email_address, FROM_UNIXTIME(date_registered) FROM ${dbpref}_members WHERE is_activated=3 ORDER BY date_registered DESC;"
+echo
+echo
+echo Approved users with zero posts:
+echo
+mysql ${mysqlargs} --execute="SELECT id_member, member_name, email_address, FROM_UNIXTIME(date_registered), FROM_UNIXTIME(last_login) FROM ${dbpref}_members WHERE is_activated=1 AND posts=0 ORDER BY date_registered"
--- /dev/null
+# PLACEHOLDER FILE!
+# This script is not yet ready for publication, as it contains environment-specific and/or hard-coded sensitive data.
+# This file is here to annoy myself to make an update.
+# ~ MegaBrutal
--- /dev/null
+#!/bin/sh
+
+if [ $# -lt 5 ]
+then
+ echo "Usage: $0 <SMF database> <table prefix> <DB user> <password file> <SMF member ID>"
+ exit
+fi
+
+dbname=$1
+dbpref=$2
+dbuser=$3
+dbpass=$4
+smfidmember=$5
+
+if [ "$(stat -c %A/%U ${dbpass})" != "-r--------/$(whoami)" ]
+then
+ echo "Password file must have 400 permissions and must be owned by you! (And it must exist, by the way.)"
+ exit
+fi
+
+mysqlargs="--user=${dbuser} --password=$(cat ${dbpass}) --database=${dbname} --default-character-set=utf8"
+
+echo SYSTEM INFO:
+uname -a
+echo
+echo SYSTEM UPTIME:
+uptime
+echo
+echo MYSQL VERSION:
+/usr/sbin/mysqld --version
+echo
+echo DATABASE NAME:
+echo ${dbname}
+echo
+echo SMF USER:
+mysql ${mysqlargs} --batch --raw --skip-column-names --execute="SELECT id_member, member_name FROM ${dbpref}_members WHERE id_member = $smfidmember" | sed 's+\t+ / +'
+echo
+echo
+echo User profile:
+echo
+mysql ${mysqlargs} --execute="SELECT * FROM ${dbpref}_members WHERE id_member = $smfidmember\G"
+echo
+echo
+echo Custom profile settings:
+echo
+mysql ${mysqlargs} --execute="SELECT * FROM ${dbpref}_themes WHERE id_member = $smfidmember\G"