]> git.sesse.net Git - backup.sh/blob - backup-cron.sh
Support changing compressors (e.g. to get zstd or xz).
[backup.sh] / backup-cron.sh
1 #! /bin/sh
2
3 bindir=/home/backup                     # Location of backup.sh
4 confdir=/home/backup/conf/              # Configuration files
5
6 logbasename=`$bindir/logfilename.sh`
7
8 # The computers we want to back up
9 unixcomputers=`cat $confdir/computers.unix \
10   | grep -v "^#" \
11   | grep -v "^$" `
12
13 # Take the backups in parallel, but wait with actually outputting the logs
14 # until we have them all and can output them nicely in sequence.
15 for computer in $unixcomputers; do
16         (
17                 $bindir/backup.sh $computer \
18                         >>$logbasename.$computer.stdout \
19                         2>>$logbasename.$computer.stderr \
20                 || touch $logbasename.failed
21         ) &
22 done
23
24 wait
25
26 # Output the logs.
27 if [ -f "$logbasename.failed" ]; then
28         echo "One or more backup jobs failed."
29 else
30         echo "All backups successful."
31 fi
32
33 echo ""
34 echo ""
35 echo "Individual logs from each backup follow:"
36 echo ""
37
38 for computer in $unixcomputers; do
39         echo "$computer"
40         echo "=========================="
41         cat $logbasename.$computer.stdout
42         echo ""
43 done