FreeBSD Bugzilla – Attachment 187997 Details for
Bug 86388
[geom] [geom_part] periodic(8) daily should backup gpart(8) partition labels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Backup of gmirror list detailed info
222.backup-gmirror.sh (text/plain), 1.53 KB, created by
Miroslav Lachman
on 2017-11-14 17:18:37 UTC
(
hide
)
Description:
Backup of gmirror list detailed info
Filename:
MIME Type:
Creator:
Miroslav Lachman
Created:
2017-11-14 17:18:37 UTC
Size:
1.53 KB
patch
obsolete
>#!/bin/sh > >## $Id: 222.backup-gmirror.sh 9fb4e01613c0 2017-09-27 11:57 +0200 lachman $ >## Created by: Miroslav Lachman <000.fbsd@quip.cz> > >## Backup of gmirror list detailed info about all gmirrors. >## Data are stored on local filesystem, in /var/backup. >## It is recommended to copy those files to off-site storage. > > >## If there is a global system configuration file, suck it in. >## >if [ -r /etc/defaults/periodic.conf ] >then > . /etc/defaults/periodic.conf > source_periodic_confs >fi > >bak_dir=/var/backups > >rotate() { > base_name=$1 > show_diff=$2 > file="$bak_dir/$base_name" > > if [ -f "${file}.bak" ] ; then > rc=0 > if cmp -s "${file}.bak" "${file}.tmp"; then > rm "${file}.tmp" > else > rc=1 > [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp" > mv "${file}.bak" "${file}.bak2" || rc=3 > mv "${file}.tmp" "${file}.bak" || rc=3 > fi > else > rc=1 > mv "${file}.tmp" "${file}.bak" || rc=3 > [ -n "$show_diff" ] && cat "${file}.bak" > fi >} > >case "$daily_backup_gmirror_enable" in > [Yy][Ee][Ss]) > > gmirrors=$(gmirror status 2> /dev/null | > awk '$1 ~ /^mirror\// { sub(/mirror\//, ""); print $1 }') > > if [ -z "$gmirrors" ]; then > echo '$daily_backup_gmirror_enable is set but no gmirrors found.' > rc=2 > else > echo "" > echo "Backup of gmirror informations for:"; > > for m in ${gmirrors}; do > echo "$m" > safe_name=$(echo "gmirror.${m}" | tr -cs ".[:alnum:]\n" "_") > if ! gmirror status -s "${m}" | grep -F -v "COMPLETE"; then > gmirror list "${m}" > "$bak_dir/$safe_name.tmp" > rotate "$safe_name" > fi > done > fi > ;; > *) rc=0;; >esac > >exit $rc
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 86388
:
57233
|
187996
| 187997 |
187998