#!/bin/sh
-PATH=/bin:/usr/bin
+PATH=$(dirname $0):/bin:/usr/bin
-mailto=carl@ecbaldwin.net
-dev="/dev/hdc"
-sdev="ATA:1,0,0"
-imagedir="/backup/imgs"
+. config.sh
# Discover disk images by looking for .img.md5sum files in $imagedir
imgmd5=$(ls $imagedir/*.img.md5sum | head -n 1)
--- /dev/null
+#!/bin/echo This file should be sourced .
+
+mailto='carl@ecbaldwin.net'
+datadir="/var/lib/backups"
+tmpdir="/dev/shm/backups"
+currentfiles="$tmpdir/files.db"
+backupdb="$datadir/backups.db"
+backups="$tmpdir/backup-list.db"
+statusfile="$tmpdir/backup-status.txt"
+imagedir="/backup/imgs"
+lastbackupfile="$imagedir/lastbackup"
+dev="/dev/hdc"
+sdev="ATA:1,0,0"
+
+backupdirs="
+/etc
+/home
+/var/backups
+/var/lib/debfoster
+/var/lib/dpkg
+/var/lib/ip6tables
+/var/lib/iptables
+/var/lib/mailman
+"
--- /dev/null
+#!/bin/sh
+
+export PATH=$(dirname $0):/bin:/usr/bin
+
+. config.sh
+
+if [ -n "$(find $lastbackupfile -mtime +14)" ]; then
+ echo "Running backups from cron..."
+ exec pack-image.sh
+fi
+
+echo "Not running backups today. Backups were last run on $(<$lastbackupfile)"
export PATH=$scriptsdir:$PATH
+. config.sh
+
# file locations and other values
today=$(date +%Y%m%d%H%M%S)
-mailto='carl@ecbaldwin.net'
-datadir="/var/lib/backups"
-backupdirs="/home /etc /var/backups /var/lib/debfoster /var/lib/mailman /var/lib/iptables /var/lib/ip6tables /var/lib/dpkg"
-tmpdir="/dev/shm/backups"
-currentfiles="$tmpdir/files.db"
-backupdb="$datadir/backups.db"
-backups="$tmpdir/backup-list.db"
-statusfile="$tmpdir/backup-status.txt"
-imagedir="/backup/imgs"
isoimage="$imagedir/$today.img"
isomountdir="$isoimage.mnt"
restorescript="$scriptsdir/restore.sh"
md5sum $isoimage | awk '{print$1}' > $isoimage.md5sum
cat $statusfile | mailx -s "DVD image available to burn - $today" $mailto
+
+echo $today > $lastbackupfile