Skip to content

Instantly share code, notes, and snippets.

@neon12345
neon12345 / backup_test.sh
Last active September 24, 2023 16:17
Backup cleanup algorithm test
#!/bin/bash
# This script will simulate an infinite backup cycle per day.
# Empty backup files are created in the current working directory
# and deleted acording to the cleanup algorithm parameters.
# One file per second is created, which is one simulated day.
# => It is best to run this script form inside an empty test directory.
# This script will not halt and must be aborted!
# The same algorithm is used in https://github.com/bit-team/backintime
set -o pipefail
@neon12345
neon12345 / backup.sh
Last active September 20, 2023 14:30
Manage a Btrfs snapshot history chain as visible files for SnapRAID
#!/bin/bash
# usage: ./backup.sh btrfs_root_path
# requirements:
# 1. $BACKUP_DIR must not exist in the btrfs_root_path
# 2. current, new, top, old must not exist in the btrfs_root_path
# how it works:
# The script creates a single btrfs snapshot "new" per invocation and btrfs sends it
# to the $BACKUP_DIR with a "current" snapshot as parent.
# Thus the btrfs send is incremental with either an initial "current" snapshot
# or a "current" snapshot from the previous invocation.
#!/bin/sh
py_script='
import mmap, base64, sys, getopt
def main(argv):
inputfile = ""
needle = b""
try:
#!/bin/sh
py_script='
import mmap, base64, sys, getopt
def main(argv):
inputfile = ""
needle = b""
try:
#!/bin/sh
py_script='
import mmap, base64, sys, getopt
def main(argv):
needle = b""
try:
opts, args = getopt.getopt(argv,"hn:",["needle="])