]> arthur.barton.de Git - backup-script.git/blob - bin/backup-script
Write more information to "stamp file"
[backup-script.git] / bin / backup-script
1 #!/bin/bash
2 #
3 # backup-script system for cloning systems using rsync
4 # Copyright (c)2008-2015 Alexander Barton <alex@barton.de>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
11 #
12
13 NAME=$(basename "$0")
14 PIDFILE="/var/run/$NAME.pid"
15
16 DRYRUN=0
17 VERBOSE=0
18
19 export LC_ALL=C
20
21 declare -i count_all=0
22 declare -i count_started=0
23 declare -i count_ok=0
24 declare -i count_ok_vanished=0
25
26 destinations=""
27
28 # Default settings, can be overwritten in backup-script.conf:
29 [ -d "/usr/local/etc/backup-script.d" ] \
30         && conf_d="/usr/local/etc/backup-script.d" \
31         || conf_d="/etc/backup-script.d"
32 pre_exec=""
33 post_exec=""
34 default_backup_type="rsync"
35 default_source_root="/"
36 default_files="running-config"
37 default_target="/var/backups"
38 default_user="root"
39 default_ssh_args_add=""
40 default_rsync_args_add=""
41 default_exclude_args_add=""
42 default_exclude_dirs_add=""
43 default_compress=1
44 default_ping=1
45 default_local=0
46 default_generations=0
47 default_job_pre_exec=""
48 default_job_post_exec=""
49
50 Usage() {
51         echo "Usage: $NAME [<options>] [<system> [<system> [...]]]"
52         echo
53         echo "  -p, --progress    Show progress, see rsync(1)."
54         echo "  -n, --dry-run     Test run only, don't copy any data."
55         echo
56         echo "When no <system> is given, all defined systems are used."
57         echo
58         echo -e $config_info
59         echo
60         exit 2
61 }
62
63 CleanUp() {
64         if [ -n "$post_exec" ]; then
65                 echo "Executing \"$post_exec\" ..."
66                 sh -c $post_exec
67                 if [ $? -ne 0 ]; then
68                         echo "Warning: post-exec command failed!"
69                 fi
70                 echo
71         fi
72         rm -f "$PIDFILE"
73 }
74
75 GotSignal() {
76         echo
77         echo "--> Got break signal, cleaning up & aborting ..."
78         echo
79         CleanUp
80         echo -n "Aborted: "; date
81         echo
82         sleep 3
83         exit 9
84 }
85
86 ExecJob() {
87         local what="$1"
88         local cmd="$2"
89
90         echo "Running job ${what}-exec command ..."
91         [ "$local" -eq 0 ] \
92                 && cmd="$ssh_cmd ${user}@${system} $cmd"
93         echo -n "Start date (${what}-exec): "; date
94         echo "$cmd"
95         if [ "$DRYRUN" -eq 0 ]; then
96                 $SHELL -c "$cmd"; local ret=$?
97         else
98                 echo " *** Trial run, not executing ${what}-exec command!"
99                 ret=0
100         fi
101         [ $ret -eq 0 ] \
102                 && echo "The ${what}-exec command completed with status 0, OK." \
103                 || echo "The ${what}-exec command completed with ERRORS, code $ret!"
104         return $ret
105 }
106
107 GetFS() {
108         local dir="$1"
109
110         while [ -n "$dir" ]; do
111                 findmnt -fn -o FSTYPE --raw "$dir" 2>/dev/null; local r=$?
112                 if [ $r -eq 0 ]; then
113                         return 0
114                 elif [ $r -eq 127 ]; then
115                         echo "UNKNOWN"
116                         return 1
117                 fi
118                 dir=$(dirname "$dir") || return 1
119         done
120 }
121
122 CreateSubvolume() {
123         local volume="$1"
124         local fs
125         local dir
126
127         dir=$(dirname "$volume")
128         fs=$(GetFS "$dir")
129         case "$fs" in
130           "btrfs")
131                 btrfs subvolume create "$volume"  >/dev/null || return 1
132                 ;;
133           "zfs")
134                 zfs create "$(echo "$volume" | cut -c2-)" || return 1
135                 ;;
136           *)
137                 echo "CreateSubvolume: Incompatible FS type \"$fs\" on \"$dir\"!"
138                 return 9
139         esac
140         return 0
141 }
142
143 CloneSubvolume() {
144         local source="$1"
145         local volume="$2"
146         local snapshot="$3"
147         local dir
148         local fs
149         local link_name
150
151         dir=$(dirname "source")
152         fs=$(GetFS "$source")
153         case "$fs" in
154           "btrfs")
155                 btrfs subvolume snapshot "$source" "$snapshot"  >/dev/null || return 1
156                 ;;
157           "zfs")
158                 zfs snapshot "$snapshot" || return 1
159                 link_name="$(echo "$snapshot" | cut -d@ -f2-)"
160                 ln -s \
161                         "current/.zfs/snapshot/$link_name" \
162                         "$(dirname "$volume")/$link_name"
163                 ;;
164           *)
165                 echo "CloneSubvolume: Incompatible FS type \"$fs\" on \"$source\"!"
166                 return 9
167         esac
168         return 0
169 }
170
171 RenameSubvolume() {
172         local source="$1"
173         local target="$2"
174         local fs
175
176         fs=$(GetFS "$source")
177         case "$fs" in
178           "btrfs")
179                 mv "$source" "$target" || return 1
180                 ;;
181           "zfs")
182                 zfs rename \
183                   "$(echo "$source" | cut -c2-)" \
184                   "$(echo "$target" | cut -c2-)" \
185                         || return 1
186                 ;;
187           *)
188                 echo "RenameSubvolume: Incompatible FS type \"$fs\" on \"$source\"!"
189                 return 9
190         esac
191         return 0
192 }
193
194 DeleteSubvolume() {
195         local volume="$1"
196         local fs
197         local id
198         local snapshot
199
200         fs=$(GetFS "$volume")
201         case "$fs" in
202           "btrfs")
203                 btrfs subvolume delete "$volume" >/dev/null || return 1
204                 ;;
205           "zfs")
206                 id="$(basename "$volume")"
207                 if [ -h "$volume" ]; then
208                         snapshot="$(dirname "$volume")/current@$id"
209                 else
210                         snapshot="$volume"
211                 fi
212                 zfs destroy -r "$(echo "$snapshot" | cut -c2-)" >/dev/null || return 1
213                 [ -h "$volume" ] && rm "$volume"
214                 ;;
215           *)
216                 echo "DeleteSubvolume: Incompatible FS type \"$fs\" on \"$volume\"!"
217                 return 9
218         esac
219         return 0
220 }
221
222 Initialize_Last_SysTarget_Snapshot() {
223         sys_target="$1"
224         unset last
225         unset snapshot
226
227         fs=$(GetFS "$sys_target")
228         case "$fs" in
229           "btrfs")
230                 # Search directory of last generation, if any
231                 last=$(ls -1d "$sys_target"/[0-9]* 2>/dev/null | sort -r | head -n1)
232                 if [ -n "$last" ]; then
233                         if [ ! -d "$last" ]; then
234                                 echo "Last snapshot \"$last\" seems not to be a directory!? \"$system\" skipped!"
235                                 echo
236                                 return 1
237                         fi
238                 fi
239                 sys_target="$sys_target/$(date +%Y%m%d-%H%M%S)"
240                 snapshot="$sys_target"
241                 ;;
242           "zfs")
243                 # On ZFS, the last generation is always named "current"
244                 if [ -e "$sys_target/current" ]; then
245                         last="$sys_target/current"
246                         if [ "$(uname)" = "Linux" ]; then
247                                 date=$(LC_ALL=C stat "$1" | grep "^Modify: " \
248                                  | cut -d':' -f2- | cut -d. -f1)
249                         else
250                                 date=$(LC_ALL=C stat -f "%Sc" "$1")
251                         fi
252                         date=$(echo "$date" | sed -e's/^ //g' -e 's/[-:]//g' -e 's/ /-/g')
253
254                 else
255                         last=""
256                         date="$(date +%Y%m%d-%H%M%S)"
257                 fi
258                 snapshot="$(echo "$sys_target/current" | cut -c2-)@$date"
259                 sys_target="$sys_target/current"
260                 ;;
261           *)
262                 echo "Initialize_Last_SysTarget_Snapshot: Incompatible FS type \"$fs\" on \"$sys_target\"!"
263                 return 1
264         esac
265         return 0
266 }
267
268 # Search configuration file (last one is used as default!)
269 for conf in \
270         "/usr/local/etc/backup-script.conf" \
271         "/etc/backup-script.conf" \
272         "${conf_d}/backup-script.conf" \
273         "/usr/local/etc/backup-script.conf" \
274 ; do
275         [ -r "$conf" ] && break
276 done
277
278 # Read in configuration file
279 config_info="Configuration file is \"$conf\""
280 if [ -r "$conf" ]; then
281         source "$conf"
282 else
283         config_info="${config_info} (not readable, using defaults)"
284 fi
285 config_info="${config_info},\nusing \"$conf_d\" as configuration directory."
286
287 while [ $# -gt 0 ]; do
288         case "$1" in
289           "-n"|"--dry-run")
290                 DRYRUN=1; shift
291                 ;;
292           "-p"|"--progress")
293                 VERBOSE=1; shift
294                 ;;
295           "-"*)
296                 Usage
297                 ;;
298           *)
299                 break
300         esac
301 done
302
303 echo -n "Started: "; date
304 echo -e "$config_info"
305
306 # Check rsync and its protocol version
307 rsync=$(which "rsync" 2>/dev/null)
308 if [ $? -ne 0 ]; then
309         echo "Failed to detect rsync(1)! Is it installed in your \$PATH?"
310         exit 1
311 fi
312 rsync_proto=$($rsync --version 2>/dev/null | head -n 1 | sed 's/.*  protocol version \([0-9]*\)$/\1/')
313 if [ $? -ne 0 ]; then
314         echo "Failed to detect protocol version of $rsync!"
315         exit 1
316 fi
317 echo "Rsync command is $rsync, protocol version $rsync_proto."
318 echo
319
320 trap GotSignal SIGINT
321
322 if [ $# -ge 1 ]; then
323         for s in "$@"; do
324                 if [ ! -r "${conf_d}/$s" ]; then
325                         echo "$NAME: Can' read \"${conf_d}/$s\"!"
326                         exit 3
327                 fi
328                 sys="$sys ${conf_d}/$s"
329         done
330 else
331         sys="${conf_d}/"*
332 fi
333
334 # check and create PID file
335 if [ -e "$PIDFILE" ]; then
336         echo "Lockfile \"$PIDFILE\" already exists."
337         echo "Is an other instance still running?"
338         echo
339         echo -n "Aborted: "; date
340         echo
341         exit 4
342 fi
343 touch "$PIDFILE" 2>/dev/null
344 if [ $? -ne 0 ]; then
345         echo "Warning: can't create PID file \"$PIDFILE\"!"
346         echo
347 else
348         echo "$$" >>"$PIDFILE"
349 fi
350
351 if [ -n "$pre_exec" ]; then
352         echo "Executing \"$pre_exec\" ..."
353         sh -c $pre_exec
354         if [ $? -ne 0 ]; then
355                 echo "Error: pre-exec command failed!"; echo
356                 CleanUp
357                 echo "Aborting backup."; echo
358                 exit 5
359         fi
360         sleep 2
361         echo
362 fi
363
364 for f in $sys; do
365         [[ -r "$f" && -f "$f" ]] || continue
366
367         fname=$(basename "$f")
368         case "$fname" in
369                 "backup-script.conf"|*.sh)
370                         continue
371                         ;;
372         esac
373
374         # Set global defaults
375         system="$fname"
376         backup_type="$default_backup_type"
377         user="$default_user"
378         source_root="$default_source_root"
379         files="$default_files"
380         target="$default_target"
381         ssh_args_add="$default_ssh_args_add"
382         rsync_args_add="$default_rsync_args_add"
383         exclude_args_add="$default_exclude_args_add"
384         exclude_dirs_add="$default_exclude_dirs_add"
385         compress="$default_compress"
386         ping="$default_ping"
387         local="$default_local"
388         generations="$default_generations"
389         job_pre_exec="$default_job_pre_exec"
390         job_post_exec="$default_job_post_exec"
391
392         # Compatibility with backup-pull(1) script: Save global values ...
393         pre_exec_saved="$pre_exec"
394         post_exec_saved="$post_exec"
395
396         # Compatibility with backup-pull(1) script: Set defaults
397         host=""
398         unset source
399         unset pre_exec
400         unset post_exec
401
402         # Read in system configuration file
403         source "$f"
404
405         # Compatibility with backup-pull(1) script: Fix up configuration
406         [[ "$system" = "$fname" && -n "$host" ]] \
407                 && system="$host"
408         [[ "$source_root" = "$default_source_root" && -n "$source" ]] \
409                 && source_root="$source"
410         [[ -z "$job_pre_exec" && -n "$pre_exec" ]] \
411                 && job_pre_exec="$pre_exec"
412         [[ -z "$job_post_exec" && -n "$post_exec" ]] \
413                 && job_post_exec="$post_exec"
414
415         # Compatibility with backup-pull(1) script: Restore global values ...
416         pre_exec="$pre_exec_saved"
417         post_exec="$post_exec_saved"
418
419         # Validate configuration
420         if [[ "$system" = "localhost" || "$system" = "127.0.0.1" ]]; then
421                 # Local system
422                 local=1
423                 compress=0
424         fi
425
426         # Make sure "source" ends with a slash ("/")
427         case "$source" in
428           "*/")
429                 ;;
430           "*")
431                 source="$source/"
432         esac
433
434         # Make sure "target" DOESN'T end with a slash ("/")
435         case "$target" in
436           "*/")
437                 target=$( echo "$target" | sed -e 's/\/$//g' )
438                 ;;
439         esac
440
441         [ "$system" = "$fname" ] \
442                 && systxt="\"$system\"" \
443                 || systxt="\"$fname\" [\"$system\"]"
444         [ "$local" -eq 0 ] \
445                 && echo "Working on $systxt ..." \
446                 || echo "Working on $systxt (local system) ..."
447
448         count_all=$count_all+1
449
450         # Check target directory
451         if [ -z "$target" ]; then
452                 echo "No target directory specified for \"$system\"!? Skipped!"
453                 echo; continue
454         fi
455         if [ ! -d "$target" ]; then
456                 echo "Target \"$target\" is not a directory!? \"$system\" skipped!"
457                 echo; continue
458         fi
459
460         sys_target="$target/$fname"
461         sys_root="$sys_target"
462         if [[ "$DRYRUN" -eq 0 && ! -e "$sys_target" ]]; then
463                 if [ $generations -gt 0 ]; then
464                         CreateSubvolume "$sys_target"
465                 else
466                         mkdir -p "$sys_target"
467                 fi
468                 if [ $? -ne 0 ]; then
469                         echo "Can't create \"$sys_target\"!? \"$system\" skipped!"
470                         echo; continue
471                 fi
472         fi
473
474         if [[ "$local" -eq 0 && "$ping" -ne 0 ]]; then
475                 # Check if system is alive
476                 ping -c 1 "$system" >/dev/null 2>&1
477                 if [ $? -ne 0 ]; then
478                         echo "Host \"$system\" seems not to be alive!? Skipped."
479                         echo; continue
480                 fi
481                 echo "OK, host \"$system\" seems to be alive."
482         fi
483
484         if [ $generations -gt 0 ]; then
485                 # Make sure no old backup is stored in system directory
486                 if [ -e "$sys_target/.stamp" ]; then
487                         # There seems to be a genearation-less backup in the
488                         # target directory!
489                         echo "Target directory \"$sys_target\" seems to be unclean!? \"$system\" skipped!"
490                         echo; continue
491                 fi
492
493                 Initialize_Last_SysTarget_Snapshot "$sys_target" || continue
494
495                 if [[ -n "$last" && ! -e "$last/.stamp" ]]; then
496                         # Old backup directory without "stamp file", continue
497                         echo "Found incomplete snapshot in \"$last\", reusing and renaming it ..."
498                         RenameSubvolume "$last" "$sys_target"
499                         if [ $? -ne 0 ]; then
500                                 echo "Failed to rename last snapshot \"$last\" to \"$sys_target\"!? \"$system\" skipped!"
501                                 echo; continue
502                         fi
503                 elif [ -n "$last" ]; then
504                         # Old backup directory found, create new snapshot
505                         echo "Found last snapshot in \"$last\"."
506                         if [ "$DRYRUN" -eq 0 ]; then
507                                 CloneSubvolume "$last" "$sys_target" "$snapshot"; r=$?
508                                 if [ $r -ne 0 ]; then
509                                         echo "Can't create snapshot \"$snapshot\" of \"$last\", code $r!? \"$system\" skipped!"
510                                         echo; continue
511                                 fi
512                                 echo "Created new snapshot in \"$snapshot\"."
513                         else
514                                 echo " *** Trial run, not creating new snapshot in \"$snapshot\"!"
515                         fi
516                 else
517                         # No old backup found, create new subvolume
518                         if [ "$DRYRUN" -eq 0 ]; then
519                                 CreateSubvolume "$sys_target"; r=$?
520                                 if [ $r -ne 0 ]; then
521                                         echo "Can't create subvolume \"$sys_target\", code $r!? \"$system\" skipped!"
522                                         echo; continue
523                                 fi
524                                 echo "Created new subvolume in \"$sys_target\"."
525                         else
526                                 echo " *** Trial run, not creating new subvolume \"$sys_target\"!"
527                         fi
528                 fi
529         fi
530
531         ssh_cmd="ssh"
532         [ -n "$ssh_args_add" ] && ssh_cmd="$ssh_cmd $ssh_args_add"
533
534         # execute job "pre-exec" command, if any
535         if [ -n "$job_pre_exec" ]; then
536                 ExecJob pre "$job_pre_exec" ; ret=$?
537                 if [ $ret -ne 0 ]; then
538                         [ $ret -ne 99 ] && count_started=$count_started+1
539                         echo "Pre-exec command failed, \"$system\" skipped!"
540                         echo; continue
541                 fi
542         fi
543
544         # prepare (remote) command ...
545         if [[ "$backup_type" == "rsync" ]]; then
546                 cmd="$rsync --archive"
547                 [ "$compress" -ne 0 ] && cmd="$cmd --compress"
548                 [ "$local" -eq 0 ] && cmd="$cmd --rsh=\"$ssh_cmd\""
549                 cmd="$cmd --delete --delete-excluded --sparse"
550                 if [ "$VERBOSE" -gt 0 ]; then
551                         [ "$rsync_proto" -ge 31 ] \
552                                 && cmd="$cmd --info=progress2" \
553                                 || cmd="$cmd --progress"
554                 fi
555                 if [ "$source_root" = "$default_source_root" ]; then
556                         for dir in \
557                                 "/dev/**" \
558                                 "/media/**" \
559                                 "/mnt/**" \
560                                 "/net/**" \
561                                 "/proc/**" \
562                                 "/run/**" \
563                                 "/sys/**" \
564                                 "/tmp/**" \
565                                 "/var/cache/apt/**" \
566                                 "/var/log/**" \
567                                 "/var/tmp/**" \
568                         ; do
569                                 cmd="$cmd --exclude=$dir"
570                         done
571                 fi
572                 [ -n "$exclude_args_add" ] && cmd="$cmd $exclude_args_add"
573                 for dir in $exclude_dirs_add; do
574                         cmd="$cmd --exclude=$dir"
575                 done
576                 [ -n "$rsync_args_add" ] && cmd="$cmd $rsync_args_add"
577
578                 [ "$local" -eq 0 ] \
579                         && cmd="$cmd ${user}@${system}:$source_root $sys_target/" \
580                         || cmd="$cmd $source_root $sys_target/"
581         elif [[ "$backup_type" == "scp" ]]; then
582                 cmd="scp"
583                 [ "$VERBOSE" -eq 0 ] && cmd="$cmd -q"
584                 for file in $files; do
585                         cmd="$cmd ${user}@${system}:$file $sys_target/"
586                 done
587         else
588                 echo "Backup type \"$backup_type\" undefined, \"$system\" skipped!"
589                 echo; continue
590         fi
591
592         echo "Backing up to \"$sys_target\" ..."
593         echo -n "Start date: "; date
594         echo "$cmd"
595         count_started=$count_started+1
596         ok=0
597
598         if [ "$DRYRUN" -eq 0 ]; then
599                 stamp_file="$sys_target/.stamp"
600                 rm -f "$stamp_file"
601
602                 # Execute backup command:
603                 start_t=$(date "+%s")
604                 $SHELL -c "$cmd"; ret=$?
605                 end_t=$(date "+%s")
606
607                 echo "code=$ret" >"$stamp_file"
608                 echo "start_t=$start_t" >>"$stamp_file"
609                 echo "end_t=$end_t" >>"$stamp_file"
610                 echo "cmd='$cmd'" >>"$stamp_file"
611                 echo "backup_host='`hostname -f`'" >>"$stamp_file"
612                 echo "backup_user='`id -un`'" >>"$stamp_file"
613         else
614                 echo " *** Trial run, not executing save command!"
615                 ret=0
616         fi
617
618         if [ $ret -eq 20 ]; then
619                 echo "Backup of \"$system\" interrupted. Aborting ..."
620                 GotSignal
621         fi
622
623         echo -n "End date: "; date
624         if [[ $ret -eq 0 || $ret -eq 24 ]]; then
625                 [ $ret -eq 24 ] && count_ok_vanished=$count_ok_vanished+1
626
627                 echo "System \"$system\" completed with status $ret, OK."
628                 [ "$DRYRUN" -gt 0 ] || count_ok=$count_ok+1
629                 ok=1
630         else
631                 echo "System \"$system\" completed with ERRORS, code $ret!"
632         fi
633
634         # execute job "post-exec" command, if any
635         if [ -n "$job_post_exec" ]; then
636                 ExecJob post "$job_post_exec"
637         fi
638
639         if [ $generations -gt 0 ]; then
640                 # Update "latest" symlink
641                 if [ "$DRYRUN" -eq 0 ]; then
642                         rm -f "$sys_root/latest"
643                         ln -s "$sys_target" "$sys_root/latest"
644                 fi
645                 # Clean up old generations
646                 declare -i gen_count=$generations+2
647                 to_delete=$(ls -1t "$sys_root" 2>/dev/null | tail -n+$gen_count | sort)
648                 if [[ -n "$to_delete" && $ok -eq 1 ]]; then
649                         [ "$DRYRUN" -eq 0 ] \
650                                 && echo "Deleting old backup generations (keep $generations) ..." \
651                                 || echo " *** Trial run, not deleting old generations:"
652                         for delete in $to_delete; do
653                                 dir="$sys_root/$delete"
654                                 if [ ! -e "$dir/.stamp" ]; then
655                                         echo "Not deleting \"$dir\", not a backup directory!?"
656                                         continue
657                                 fi
658                                 last=$(stat "$dir/.stamp" 2>/dev/null | grep "^Modify: " \
659                                  | cut -d':' -f2- | cut -d. -f1)
660                                 echo "Removing backup from" $last "..."
661                                 if [ "$DRYRUN" -eq 0 ]; then
662                                         DeleteSubvolume "$dir"
663                                         [ $? -eq 0 ] || \
664                                           echo "Failed to delete \"$dir\"!"
665                                 fi
666                         done
667                         echo -n "Clean up finished: "; date
668                 elif [ -n "$to_delete" ]; then
669                         echo "There have been errors, not cleaning up old generations!"
670                 else
671                         echo "Nothing to clean up."
672                 fi
673         fi
674
675         destinations="$destinations $target"
676         echo
677 done
678
679 sync
680
681 if [ "$DRYRUN" -eq 0 ]; then
682         paths=""
683         paths_zfs=""
684         for dest in $(echo $destinations | sed -e 's/ /\n/g' | sort | uniq); do
685                 fs=$(GetFS "$dest")
686                 case $fs in
687                   "zfs" )
688                         paths_zfs="$paths_zfs $dest"
689                         ;;
690                   *)
691                         paths="$paths $dest"
692                 esac
693         done
694         if [ -n "$paths" ]; then
695                 df -h $paths
696                 echo
697         fi
698         if [ -n "$paths_zfs" ]; then
699                 zfs list $paths_zfs
700                 echo
701         fi
702 fi
703
704 CleanUp
705
706 echo -n "Done: "; date
707 echo
708 [ $count_all -eq 1 ] && s="" || s="s"
709 echo " - $count_all job$s defined,"
710 [ $count_started -eq 1 ] && s="" || s="s"
711 echo " - $count_started job$s started,"
712 echo " - $count_ok done without errors."
713 echo
714
715 if [ $count_started -ne $count_ok ]; then
716         echo "----->  THERE HAVE BEEN ERRORS!  <-----"
717         echo
718         exit 6
719 elif [ $count_all -ne $count_started ]; then
720         exit 7
721 fi
722
723 # -eof-